Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

4
  • Why u need promis in middleware.. You are not performing any async talk. Commented Apr 7, 2020 at 18:37
  • Anyways, reurn type of middleware should be void. Commented Apr 7, 2020 at 18:39
  • 1
    @xdeepakv I'm performing the async task of finding a user. I get that the middleware doesn't return anything, I'm uncomfortable with the idea of there being a Promise that never gets then() called on it when we use 'async' middleware. Does that make sense? Commented Apr 7, 2020 at 18:41
  • Express supports async middleware OOTB. app.use('/', async (req, res) => {.... Commented Aug 22, 2024 at 9:59