-
Notifications
You must be signed in to change notification settings - Fork 392
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
Order of routes matters #152
Comments
sounds strange, does it work if you remove |
No, that doesn't solve it. Only the order seems to solve it. Interestingly enough it only seems to crash in signIn. SignIn is being called though. setTokenForUser is defined like this: setTokenForUser: (res: Response, user: User) => {
return new Promise((resolve, reject) => {
const jwtClaimSet: JWTClaimSet = { name: user.username, email: user.email };
jwt.sign(jwtClaimSet, config.authentication.secret, { algorithm: 'HS256' },
(err: Error, token: string) => {
if (err) {
reject('Could not create jwtToken!')
console.log(err);
} else {
console.log("Hello world");
res.cookie(config.authentication.cookiename, token);
console.log(token);
resolve();
}
});
});
} It seems to crash on the cookie function call. The console.log is still being executed. |
This should not be possible. Can you please setup a git repo with a minimal reproduction of your problem, then I can checkout, debug and solve your problem. |
There you go: https://github.com/Christian24/routingcontrollersissue/tree/master Thanks a lot. |
@Christian24 For me it looks like you've forgot to return promise somewhere in you hell and because of |
@pleerock @19majkel94 same problem here!!! I have two endpoints on controller 'UserController'
both marked as some requests executes /:userId with 'me' as param |
Stale issue message |
Hello,
awesome project. I have an issue though. My JSON-Controller looks like this:
This crashes on the sign_in route.
Cannot POST /users/sign_in
. Funny enough if I change the order to have the GET route at the top of the class like this:everything works fine. Is there something I am missing or is this a bug?
Thanks a lot,
Christian
The text was updated successfully, but these errors were encountered: