Created
August 18, 2019 22:14
-
-
Save caesaneer/cb9879f3a2149c2fbba1b6795f7ca401 to your computer and use it in GitHub Desktop.
Part 2 - Node.js Single Process
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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