Skip to content
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

Cannot skip route with middleware #334

Open
srosset81 opened this issue Sep 18, 2023 · 1 comment
Open

Cannot skip route with middleware #334

srosset81 opened this issue Sep 18, 2023 · 1 comment

Comments

@srosset81
Copy link

srosset81 commented Sep 18, 2023

Hello,

On the index.d.ts file, it is noted we should be able to call Express-style next('route') in a middleware to skip to another route:

moleculer-web/index.d.ts

Lines 393 to 405 in 29637c1

interface NextFunction {
(err?: any): void;
/**
* "Break-out" of a router by calling {next('router')};
* @see https://expressjs.com/en/guide/using-middleware.html#middleware.router
*/
(deferToNext: "router"): void;
/**
* "Break-out" of a route by calling {next('route')};
* @see https://expressjs.com/en/guide/using-middleware.html#middleware.application
*/
(deferToNext: "route"): void;
}

But when I do that, an error is simply thrown with "route" as the message (Request error! MoleculerError : route).

Would it be possibly to add this option ?

Many thanks

@srosset81
Copy link
Author

srosset81 commented Sep 18, 2023

Finally I find it easier to handle my problem by changing routes priorization. See the other issue I opened: #335

However I keep this issue open because, if next("route") is not handled, it should not appear on the index.d.ts file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant