const express = require('express')
const app = express()
app.get('/', (req, res) => {
res.send("helo")
});
app.post('/', (req, res) => {
console.log('served');
name(res);
});
async function name(res) {
console.log('waiting')
var waitTill = new Date(new Date().getTime() + 10 * 1000);
while(waitTill > new Date()){}
res.send('ok');
console.log('out of waiting')
}
app.listen(3000, () => console.log('Example app listening on port 3000!'))
Simply: Server not behaving asyncronously
Explanation: here's the code, now there's a wait of 10 seconds in name function. As I know, if a client comes and it stucks on wait. another client shouldn't be effected. But in my code, the second client had to wait until the first client is catered.