Skip to content

Instantly share code, notes, and snippets.

@caesaneer
Last active April 16, 2020 09:25
Show Gist options
  • Save caesaneer/77617193024956fb964f568afbf8f04a to your computer and use it in GitHub Desktop.
Save caesaneer/77617193024956fb964f568afbf8f04a to your computer and use it in GitHub Desktop.
Go Goroutines vs Node.js Cluster & Worker Threads - Part 1 - Node.js Code - NO CLUSTER
const http = require('http')
const host = '192.168.0.14'
const port = 3000
const start = function startServer() {
// Simple request router
const router = function requestRouter(request, reply) {
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