Routing-controllers: question: conflict in routes names

Created on 11 Mar 2020  路  7Comments  路  Source: typestack/routing-controllers

I have the same issue here #213
it solved by regex match ids but I have mongodb _id and this solution will not be helpful and ideas ?

question

All 7 comments

could you please describe what exactly your problem is? How does it differ with mongodb?
How do your conflicting endpoints look atm?

My problem is when I GET items/all it go to items/:id
in the mentioned issue it solved by using regex @Get('items/:itemId([0-9]+)')
but I am using mongodb and ids is not just numbers it is complex of strings and numbers

ah, I am actually stuck at some similar problem.
I have two routes @Get('/users/:id') & @Get('/users/:name'). Where my usernames are in the format (anything)-(fourdigits) (e.g.: firstnameLastname-1234)
@Get('/users/:id([0-9]+)') works for the id, which is numerical.
But @Get('/users/:name(.+-[0-9]{4})') does not work, although the regex pattern is correct.

@NoNameProvided shamelessly asking you for help here

I have a similar issue. Im trying to have an action for a specific user, so my routes look like that:

/api/user/:id
/api/user/:id/action

But i get an "cannot set header twice" error. Is there a known workaround?

For future readers: a feature landed which prevents this behavior. Now routing-controllers will stop after processing the first matching route.

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mlarsson picture mlarsson  路  5Comments

gruckion picture gruckion  路  5Comments

dcbartlett picture dcbartlett  路  3Comments

impzero picture impzero  路  4Comments

codedoge picture codedoge  路  6Comments