Comments (8)
- read the https://github.com/nestjs/nest/blob/master/CONTRIBUTING.md
- pick any open Issue and try to solve it
Use our discord server http://discord.gg/nestjs to discuss it further if needed.
from nest.
@AbanobNageh @micalevisk
this works!
I have confirmed that I can use such regular expressions to exclude specific pattern paths from the middleware.
consumer
.apply(AppMiddleware)
.exclude({ path: '/:id(\\d+)', method: RequestMethod.GET })
.forRoutes(AppController);
from nest.
there is another configuration where it does not work:
this will ignore previous exclude calls
consumer.apply(someMiddleware)
.exclude('id')
.exclude('somethingelse')
this works
consumer.apply(someMiddleware)
.exclude('id', 'somethingelse')
from nest.
@satanshiro I guess that's another issue. Would you like to create a PR to fix that one?
from nest.
and @satanshiro this code works, too!
consumer
.apply(AppMiddleware)
.exclude({ path: 'all', method: RequestMethod.GET })
.exclude({ path: '/:id(\\d+)', method: RequestMethod.GET })
.forRoutes(AppController);
from nest.
@micalevisk
Hello, I am a university student from South Korea developing with NestJS.
I would like to contribute to NestJS, but I am not sure where to start. Could you help me?
Someday, I hope to make a significant contribution to the NestJS framework!
Thanks for reading!
from nest.
@EeeasyCode Thank you. However, How did you test this? The code you included doesn't work for me. I tried it on my reproduction repo above and the tests still fail.
Also, my knowledge of Regex is lacking so excuse me if I am wrong but are you saying that for every path with a param (ex: /:id
) we would need to explicitly add the paths that should not match (ex: /all
)? If this is the case then this could be an ok temporary solution for small codebases but it doesn't seem like a feasible solution for large codebases where there could be many such endpoints.
from nest.
I think I found the cause of the issue. When /:id
is entered, it receives the id in the format of /1
or /test
, and in such cases, it cannot distinguish between @Get('/1')
and @Get('/test')
. To handle this, you should either use the regular expression I initially suggested or specify the path with a prefix in the Controller.
from nest.
Related Issues (20)
- Typescript compilation error with fastify adapter HOT 4
- Payment integration using phonepay documentation HOT 1
- handleConnection method can conflict with WebSocket Gateway lifecycle hook HOT 1
- Feat: Add support for turbopack HOT 1
- The sequence of messages from the Observable pipe in the sse method of router-response-controller.ts is disordered. HOT 1
- configurable threshold for The module ... is taking ...ms to serialize HOT 2
- owned types are marked as extension HOT 1
- zod validation with @Param error HOT 1
- Why I can't use Logger in extended (child) classes? HOT 1
- path is undefined when using file FilesInterceptor for file uploading HOT 2
- How to use metadata to get information from decorators HOT 2
- NestJs middlewares don't run when fastify is the HTTP adapter HOT 3
- Just started with the boilerplate and test does not run HOT 2
- MQTT microservice mishandles `data` key in JSON payload HOT 2
- Silently crashing(?) when using promises to create a locking mechanism between independent modules via factory provider HOT 1
- Typescript Error for using the version 10.3.9 of @nestjs/platform-fastify. HOT 2
- response.getHeaders() function always returns empty object in NestJS with Fastify. HOT 2
- with queue's enabled not all EventPattern's get triggered HOT 1
- Request for Drizzle ORM Recipe for NestJS Framework
- "Nest new path" Does not install Typeorm dependencies. HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nest.