From the course: Mastering Nest.js: Build Scalable Applications with Mastery in Nest.js Framework
Unlock this course with a free trial
Join today to access over 25,200 courses taught by industry experts.
Excluding routes - Nest.js Tutorial
From the course: Mastering Nest.js: Build Scalable Applications with Mastery in Nest.js Framework
Excluding routes
When we want to exclude certain routes from having the middleware applied on them, we can easily do that by using the exclude method. Let's understand it practically. Previously, we tried to exclude the post route by giving this syntax where we specified the route method dot get to target all the get routes and exclude the rest. Now let's try to exclude the post route with the help of the exclude method. It follows the same syntax that is path property, I will set it to route 4 and the method property where I give the request method dot post. So this is how we can exclude a particular route. Now in the for routes method, I will simply update the path without any properties. Let's try this out. I'll open the postman, we'll change the method type to post and give the slash route for in the path. the content type is set to application slash JSON. Let's make the request and the content type is returned. Now let's change the content type to application slash JavaScript and make the…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
(Locked)
Introduction to Nest middlewares3m 46s
-
(Locked)
Implementing middleware3m 45s
-
(Locked)
Registering a middleware5m 20s
-
(Locked)
Route-specific middleware5m 48s
-
(Locked)
Assignment: Checking Content-Type with middleware4m
-
(Locked)
Handling route wildcards3m 19s
-
(Locked)
Middleware for specific route handlers4m 38s
-
(Locked)
Excluding routes3m 49s
-
(Locked)
Controller-driven route middleware2m 15s
-
(Locked)
Understanding functional middleware4m 26s
-
(Locked)
Applying multiple middlewares6m 51s
-
(Locked)
Applying global middlewares3m 52s
-
(Locked)
Assignment: Password encryption middleware10m 19s
-
(Locked)
-
-
-
-
-
-
-
-