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.
Handling route wildcards - Nest.js Tutorial
From the course: Mastering Nest.js: Build Scalable Applications with Mastery in Nest.js Framework
Handling route wildcards
In NestJS, route wildcards are placeholders within routes that match any combination of characters in that position of the URL. They are mainly denoted by an asterisk sign. This asterisk acts as a wildcard character, matching any combination of characters. For instance, in the route path, ab asterisk cd, the route path would match URLs like abcd, ab underscore cd, abecd and so on. So basically, the asterisk denotes any possibility. That's what a wildcard route is. Let's understand it by looking at an example. I am going to extend the content type example which we saw previously. In here, we will add a few more get handlers. I'll change the method name to route1 and we'll change the return message as well to this is route1 under slash client. So we will define a few routes like this. The whole purpose I want to explain is how to apply a middleware on multiple or all the child routes coming under a specific controller route. I will change the route path to route 2. Will update 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)
-
-
-
-
-
-
-
-