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

Setting Node Server (https)

$
0
0

I'm very new to node and have looked up how to simply set up a node server. I feel like I have it set up correctly but when I go to https://localhost:8080/ it says "Site can't be reached". Nothing is console logged either. I've gone through many similar questions but no solution has helped me yet. I ran npm init and npm install and here is my code:

var Express = require('express');var Https = require('https');var Fs = require('fs');var app = Express();var port = process.env.EXPRESS_PORT || 8080;var options = {  key: fs.readFileSync('key.pem'),  cert: fs.readFileSync('cert.pem')};console.log("helloo?");express.createServer(options, function (req, res) {  console.log("hi")  res.writeHead(200);  res.end("hello world\n");}).listen(8080);

Viewing all articles
Browse latest Browse all 1821

Trending Articles



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