The async logic fires, but the client doesn't get the response. I'm guessing this is because the res.writeHead and res.end calls are happening after the route handler has returned.
How do we make this work?
The reason I want async is because I think it may perform better with multiple requests (any thoughts on that?). For example, here's the sync version, which works:
I can't seem to send an async response. For example, I'm trying
The async logic fires, but the client doesn't get the response. I'm guessing this is because the
res.writeHead
andres.end
calls are happening after the route handler has returned.How do we make this work?
The reason I want async is because I think it may perform better with multiple requests (any thoughts on that?). For example, here's the sync version, which works: