So i’ve just started using node.js and i’m trying to run a server for a project i’m working on. However, i’m having a hard time getting the server to run. Here is my code:
var http = require(‘http’);
http.createServer(function(req,res){
res.writeHead(200, {‘content-type":"text/plain’});
res.end(‘Hello World’);
}).listen(1337,‘127.0.0.1’);
console.log(‘server running at http://127.0.0.1:1337/’);
I’m not sure what to type in the command prompt. Like I said, i’m new to programming with Node. What I usually do is frontend development for website projects, so this is a different experience for me to be making a server.