Skip to content

Instantly share code, notes, and snippets.

@caesaneer
Created August 18, 2019 22:14
Show Gist options
  • Save caesaneer/cb9879f3a2149c2fbba1b6795f7ca401 to your computer and use it in GitHub Desktop.
Save caesaneer/cb9879f3a2149c2fbba1b6795f7ca401 to your computer and use it in GitHub Desktop.
Part 2 - Node.js Single Process
const http = require('http')
const bench = require('./bench')
const host = '192.168.0.14'
const port = 8000
const start = function startServer() {
// Simple request router
const router = function requestRouter(request, reply) {
const result = bench(100)
// console.log(result)
reply.end('OK')
}
// Start HTTP server
const server = http.createServer(router)
server.listen(port, host, () => {
console.log(`Node.js Standard Library HTTP server running on port: ${port}`)
})
}
start()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment