restify / restify/node-restify
Res.redirect won't work for async routes at all?
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 10.7k
- Forks
- 975
- Avg merge
- 1d 6h
- Merged PRs (30d)
- 5
Description
Hello Restify!
Don't know whether it's a bug or feature request. My case is as follows:
I have an async route
server.get("/verify", async (req, res) => {}
containing interaction with MongoDB via Mongoose. In that route I need to use res.redirect, which won't work, because, apparently, it needs "next", which is not declared in async routes.
I tried going the ugly "Callback Hell" way and rewriting everything without await/async, but, apparently, Mongoose no longer supports callbacks - for all the good reasons. It gave an error:
MongooseError: Model.findOne() no longer accepts a callback
Please help with an advice how to make res.redirect work in async routes.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the /verify async route described in the issue, including the res.redirect call and MongoDB/Mongoose interaction. Trace Restify's async route and redirect handling; done means determining whether redirects are supported there and documenting or implementing a clear working approach.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, mongodb, node.js
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100