Skip to content

Instantly share code, notes, and snippets.

@BasanthVerma
Last active July 28, 2016 09:45
Show Gist options
  • Select an option

  • Save BasanthVerma/f02481ebbd5e392016d75933238972c2 to your computer and use it in GitHub Desktop.

Select an option

Save BasanthVerma/f02481ebbd5e392016d75933238972c2 to your computer and use it in GitHub Desktop.

Revisions

  1. BasanthVerma revised this gist Jul 28, 2016. No changes.
  2. BasanthVerma created this gist Jul 28, 2016.
    14 changes: 14 additions & 0 deletions Simple Node JS server
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,14 @@
    const http = require('http');

    const hostname = '127.0.0.1';
    const port = 3000;

    const server = http.createServer((req, res) => {
    res.statusCode = 200;
    res.setHeader('Content-Type', 'text/html');
    res.end('Hello, from Node js\n');
    });

    server.listen(port, hostname, () => {
    console.log(`Server running at http://${hostname}:${port}/`);
    });