showing results for - "server port node js"
Josué
28 Sep 2017
1const http = require('http');
2
3const hostname = '127.0.0.1';
4const port = 3000;
5
6const server = http.createServer((req, res) => {
7  res.statusCode = 200;
8  res.setHeader('Content-Type', 'text/plain');
9  res.end('Hello World');
10});
11
12server.listen(port, hostname, () => {
13  console.log(`Server running at http://${hostname}:${port}/`);
14});