Skip to content

Instantly share code, notes, and snippets.

@koyanloshe
Last active April 17, 2020 08:29
Show Gist options
  • Save koyanloshe/da46debd03b7ca152569792dff8a9150 to your computer and use it in GitHub Desktop.
Save koyanloshe/da46debd03b7ca152569792dff8a9150 to your computer and use it in GitHub Desktop.
nodeJS server #Javascript
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\n');
});
server.listen(port, hostname, () => {
console.log(`Server running at http://${hostname}:${port}/`);
});
express --view=pug myAppName
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment