Skip to content

Instantly share code, notes, and snippets.

@Charlyzzz
Created April 28, 2020 22:07
Show Gist options
  • Save Charlyzzz/99f98e7eaeda5b91d42c39b8deac7bdf to your computer and use it in GitHub Desktop.
Save Charlyzzz/99f98e7eaeda5b91d42c39b8deac7bdf to your computer and use it in GitHub Desktop.
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/plain');
res.end('Hello World');
});
server.listen(port, hostname, () => {
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