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.write("Luke, I am your server");

See the difference with a node server using express

Add new comment

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
By submitting this form, you accept the Mollom privacy policy.