How to use async operations with Start?
sma opened this issue · comments
Stefan Matthias Aust commented
Could you please provide an example how to use async operations with Start?
I tried this, but it didn't work:
app.get('/:name', (req, res) {
new File(req.param('name')).readAsString().then((content) {
res.render('view', {'content': content});
});
});
It seems, the response stream is closed before the Future's function is called.
Yehor Lvivski commented
The problem is deeper, so I'll rewrite the routing management. The case is that default router (send file) catches and sends 404 :)
Yehor Lvivski commented
Here's some basic fix for async handlers, see example. I'll refactor it, but it seems to work