Skip to content

Instantly share code, notes, and snippets.

Last active Jan 24, 2018
What would you like to do?
Simplest Node.js Web Server
const http = require('http')
const PORT = 3000
const requestHandler = (request, response) => {
response.end('Hello World!')
const server = http.createServer(requestHandler)
server.listen(PORT, (err) => {
if (err) {
return console.log('something bad happened', err)
console.log(`server is listening on ${PORT}`)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment