-
-
Notifications
You must be signed in to change notification settings - Fork 7.7k
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
Allow Regex and Array in request mapping decorator #1343
Comments
I checked the fastify documentation, and it seems like they don't support the array version out of the box, so if we want to support this in NestJS, we will need to find a workaround for providers other than express. |
Also I think fastify, unlike express, does not support RegExp objects. |
Each server adapter should just validate whether or not regex etc is a valid option to use. |
This feature was requested in the issue nestjs#1343. When routing, besides using a single string, you can now use an array of strings in the Post, Get, ... decorators.
This feature was requested in the issue nestjs#1343. When routing, besides using a single string, you can now use an array of strings in the Post, Get, ... decorators.
PR merged and published as 5.7.0 |
I would argue that this issue is only half done. Yes, now you can use an array of strings, but the OP also asked for a regex. That would be very important for me so that we can migrate from an existing express.js solution. |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
I'm submitting a...
Current behavior
When we decorate a controller function with the Post, Get, ... decorators, the param must be a string, but as the documentation of Express JS (https://expressjs.com/en/4x/api.html#path-examples) we can use Regex or array of strings, to match with multiple paths.
Is it possible to change it to allow this two types ?
Expected behavior
The possibility to use regex and arrays as params of a request mapping decorator.
Minimal reproduction of the problem with instructions
What is the motivation / use case for changing the behavior?
Adding aliases for a route, for example for backward compatibility.
Environment
Nest version: 5.4.1
For Tooling issues:
Others:
The text was updated successfully, but these errors were encountered: