Create a Node.js webserver

To create a node webserver, the core http module needs to be included. To include an existing module you can use the require function.


var http = require("http");

http.createServer(function(request, response) {
    response.writeHead(200,{"Content-Type":"text/plain"});
    response.write("Luke, I am your server");
    response.end();
}).listen(8888);

See the difference with a node server using express