Topics


Pages


Content

How to use the built-in http library - from tutorial.

See also my gist.

This is very low-level. You probably want to use Express or something at an even higher-level.

Make a script.

  • index.js
      const http = require('http');
    
      http.createServer(function (req, res) {
        res.write('Hello World!');
        res.end();
      }).listen(8080); 
    

Then run it:

node index.js