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);
via Ryan Schweitzer
No comments:
Post a Comment