-
Notifications
You must be signed in to change notification settings - Fork 140
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Route-Exclusive Custom Constraint Strategy #311
Comments
Hi, thank you for your proposal. It makes much more sense since we added async constraints, and I think we should add it. Although it wouldn't be an easy PR for a couple of reasons:
It might take some time to add this. |
I briefly looked at the source and it does indeed look like a complicated change. The complexity is mostly due to the constraints being fully derived prior to call to /** code has been simplified **/
this.constrainer.deriveConstraints(req, ctx, (err, constraints) => {
const handle = this.find(req.method, req.url, constraints)
}) It looks like |
From reading all the docs, it seemed like a constraint that failed |
|
First of all, cheers 🍻 to all the maintainers of this amazing project. Thank you for all your hard work!
The documentation states:
I am seeking a way to limit the impact of the
deriveConstraint
function to only the routes in need of the constraint. This has been previously discussed #165.The goals:
I did create a hackish solution that involves keeping a second router as an allow list. It works, but I am not completely in love with this.
The solution relies on some Fastify methods, so example isn't limited to
find-my-way
.The above code has a function
expensiveAsyncCall
that is only run for the/sometimes
route.if
feature
is set tofalse
orexpensiveAsyncCall
returnsfalse
, the route will fallback to the"*"
route.I am not sure exactly what I am seeking here. Feedback? Direction? Help?
The text was updated successfully, but these errors were encountered: