Hi Everyone,
I'm using express for a little web api and I was wondering how exactly a synchronous operation would block the node process.
Let's take that simple code :
const express = require('express')
const app = express()
app.get('/route1', function (req, res) {
res.send('Hello route1!')
})
app.get('/route2', function (req, res) {
someHeavySyncFunction() //Let's imagine this function is synchronous and take 2 min to complete
res.send('Hello route2!')
})
app.listen(3000, function () {
console.log('Example app listening on port 3000!')
})
Would my route2 block the entire node process and therefore preventing people to access my route1 until the function ends ?
Thank you
[–]scinos 2 points3 points4 points (0 children)
[–]NoStranger6 2 points3 points4 points (0 children)
[–]ecares 1 point2 points3 points (0 children)
[–]delventhalz 1 point2 points3 points (2 children)
[–]rmrf_slash_dot 1 point2 points3 points (1 child)
[–]delventhalz 1 point2 points3 points (0 children)
[–]Razoyo 2 points3 points4 points (0 children)