Skip to content

Instantly share code, notes, and snippets.

@smali-kazmi
Last active August 28, 2019 22:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save smali-kazmi/aec34cc27419dc5ca7039e4e6340a9ea to your computer and use it in GitHub Desktop.
Save smali-kazmi/aec34cc27419dc5ca7039e4e6340a9ea to your computer and use it in GitHub Desktop.
Nginx + Node.js on mac osx
// content of app.js
const http = require('http')
const port = 3000
const requestHandler = (request, response) => {
console.log(request.url)
response.end('Hello Node.js Server!')
}
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