Skip to content

Instantly share code, notes, and snippets.

@noherczeg
Created January 30, 2021 22:12
Show Gist options
  • Save noherczeg/98af2991b82a6df223e8746c809bb2ad to your computer and use it in GitHub Desktop.
Save noherczeg/98af2991b82a6df223e8746c809bb2ad to your computer and use it in GitHub Desktop.
node web hello-world
const http = require('http')
const host = '0.0.0.0'
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, host, () => {
console.log('Web server running at http://%s:%s', host, port)
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment