Skip to content

Instantly share code, notes, and snippets.

@rasolofonirina
Last active March 25, 2022 12:39
Show Gist options
  • Save rasolofonirina/be8e310cc277ff697fba147adf7b5465 to your computer and use it in GitHub Desktop.
Save rasolofonirina/be8e310cc277ff697fba147adf7b5465 to your computer and use it in GitHub Desktop.
Event Node.js
const http = require('http')
const server = http.createServer((req, res) => {
res.writeHead(200)
res.end('Hi everybody !')
})
/*
const server = http.createServer()
server.on('request', (req, res) => {
res.writeHead(200)
res.end('Hi everybody !')
})
*/
server.on('close', () => {
console.log('Good bye !')
})
server.listen(8080)
server.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment