Nest

How can we use the new {*splat} wildcard syntax correctly in NestJS route decorators for v5?

March 18, 2026

download ready
Thank You
Your submission has been received.
We will be in touch and contact you soon!

Express v5 (NestJS 11+) killed plain * wildcards; you now need named wildcards like {*splat} or /*splat to match any path segments properly without breaking your routes.​

Replace old @Get('users/*') with @Get('users/{*splat}') or @Get('users/*splat')—the braces make it optional (matches root too) while the name satisfies Express v5's stricter rules. NestJS auto-converts some old syntax, but named wildcards are the safe, future-proof way. Use this for catch-all routes, file uploads, or API versioning.​

Code

//OLD (broken/unreliable in Express v5/NestJS 11+)
@Get('users/*')
findAll() {
  return 'Matches users/anything';
}

//NEW (Express v5 correct - recommended)
@Get('users/{*splat}')  // Matches users/, users/123, users/abc/def
findAll(@Param('splat') path: string) {
  return `Caught: ${path}`;
}

// Or path-style
@Get('files/*splat')
download(@Param('splat') filePath: string) {
  return `Serving: ${filePath}`;
}

// Guard usage too
@UseGuards(AuthGuard)
@UseInterceptors(FileInterceptor('file'))
@Put('uploads/{*splat}')
upload(@Param('splat') path: string, @UploadedFile() file: Express.Multer.File) {
  return `Uploaded to: ${path}`;
}
      
Hire Now!

Need Help with Nest Development ?

Work with our skilled nest developers to accelerate your project and boost its performance.
**Hire now**Hire Now**Hire Now**Hire now**Hire now

How can we use the new {*splat} wildcard syntax correctly in NestJS route decorators for v5?

Express v5 (NestJS 11+) killed plain * wildcards; you now need named wildcards like {*splat} or /*splat to match any path segments properly without breaking your routes.​

Replace old @Get('users/*') with @Get('users/{*splat}') or @Get('users/*splat')—the braces make it optional (matches root too) while the name satisfies Express v5's stricter rules. NestJS auto-converts some old syntax, but named wildcards are the safe, future-proof way. Use this for catch-all routes, file uploads, or API versioning.​

Code

//OLD (broken/unreliable in Express v5/NestJS 11+)
@Get('users/*')
findAll() {
  return 'Matches users/anything';
}

//NEW (Express v5 correct - recommended)
@Get('users/{*splat}')  // Matches users/, users/123, users/abc/def
findAll(@Param('splat') path: string) {
  return `Caught: ${path}`;
}

// Or path-style
@Get('files/*splat')
download(@Param('splat') filePath: string) {
  return `Serving: ${filePath}`;
}

// Guard usage too
@UseGuards(AuthGuard)
@UseInterceptors(FileInterceptor('file'))
@Put('uploads/{*splat}')
upload(@Param('splat') path: string, @UploadedFile() file: Express.Multer.File) {
  return `Uploaded to: ${path}`;
}