Creating Local Server on NodeJS

// calling HTTP module
var http = require('http');

// callback function
var requesrHandler = function(req, res){
    res.writeHead(200, {
        'content-Type': 'text/plain'
    });
    res.end('Welcome');
};

var server = http.createServer(requesrHandler);

// defining server with port 3000
server.listen(3000, 'localhost');
Linked Article

How You Should Start with NodeJs