aboutsummaryrefslogtreecommitdiff
path: root/index.js
blob: 5e753e1427e06c1464a8cbaa0c3dea0a05cef965 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
const http = require('http');

const requestHandler = (req, res) => {
  console.log(`${req.method} ${req.url}`);

  res.writeHead(200, {'Content-Type': 'text/html; charset=utf-8'});
  res.end('<h1>lol</h1>');
};

const onServerStart = () => console.log('Server started on port 8080.');

const server = http.createServer(requestHandler);
server.listen(8080, onServerStart);