Quantcast
Channel: Active questions tagged https - Stack Overflow
Viewing all articles
Browse latest Browse all 1535

I have received a TypeError (Uncaught TypeError: https.createServer is not a function) when I try to test https. Can someone helps please?

$
0
0

Im a new front end developer and I was trying to set up a new HTTPS environment. I followed the instruction from a link under https.createServer([options][, requestlistener]) section. But somehow it gives me an error of https.createServer is not a function. Can someone please help me with the question?

I was using browserify to compile:

    $npm install browserify --save    $browserify test.js -o bundle.js -t brfs

The following is my code (test.js):

    var fs = require('fs'),    https = require('https')    var options = {            ca: fs.readFileSync('ca.pem', 'utf8'),            cert: fs.readFileSync('cert.pem', 'utf8'),            rejectUnauthorized: true    };    httpsServer = https.createServer(options, (req,res) => {            res.writeHead(200);            res.end('hello world\n');    }).listen(443);

and the error that i was receiving:

    Uncaught TypeError: https.createServer is not a function

I have also tried many other ways includes using

    var express = require('express'),        app = express()

and eventually it gives me another error:

    TypeError: Cannot read property 'prototype' of undefined

Viewing all articles
Browse latest Browse all 1535

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>