Skip to content

Instantly share code, notes, and snippets.

@jkyberneees
Created October 10, 2018 20:02
Show Gist options
  • Select an option

  • Save jkyberneees/48b8044b9d8eb73575e32d3e575b370d to your computer and use it in GitHub Desktop.

Select an option

Save jkyberneees/48b8044b9d8eb73575e32d3e575b370d to your computer and use it in GitHub Desktop.
const http = require('http')
const service = new http.Server()
service.on('request', (req, res) => {
if (req.method === 'GET' && req.url === '/hi') {
res.writeHead(200, { 'Content-Type': 'text/plain' })
res.end('Hello World!')
} else {
res.statusCode = 404
res.end()
}
})
service.listen(3000)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment