Help running Node.js server

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.

What I think you should do (if I am not wrong) is type: node app.js (or whatever is your js file called).

…and have to be in your project directory (or write full path).

start by typing node nameofyourfile.js in the command line interface

You have to be in the project directory, where the main .js file is located.