В своем любимом редакторе создайте файл под названием helloworld.js (ch02/00-helloworld.js в прилагаемом к книге репозитории):
const http = require('http')
const port = process.env.PORT || 3000
const server = http.createServer((req, res) => {
res.writeHead(200, { 'Content-Type': 'text/plain' })
res.end('Hello world!')
})
server.listen(port, () => console.log(`сервер запущен на порте ${port}; ` +
'нажмите Ctrl+C для завершения...'))