Skip to content

Instantly share code, notes, and snippets.

@yoelnacho
Created November 9, 2017 00:50
Show Gist options
  • Save yoelnacho/e31988f98bdfdb9c1fa4ca29573ab77c to your computer and use it in GitHub Desktop.
Save yoelnacho/e31988f98bdfdb9c1fa4ca29573ab77c to your computer and use it in GitHub Desktop.
Create a server.js: javascript file with following code
const http = require('http');
const hostname = '127.0.0.1';
const port = 3000;
const server = http.createServer(function(req, res) {
res.statusCode = 200;
res.setHeader('Content-Type', 'text/plain');
res.end('Hello World\n');
});
server.listen(port, hostname, function() {
console.log('Server running at http://'+ hostname + ':' + port + '/');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment