# UseBefore Decorator operation
Module | import { UseBefore } from "@tsed/common" |
---|---|
Source | /packages/common/src/mvc/decorators/method/useBefore.ts |
# Overview
function UseBefore(...args: any[]): Function;
# Description
Mounts the specified middleware function or functions at the specified path: the middleware function is executed when the base of the requested path matches `path.
@Controller('/')
@UseBefore(Middleware1) // called only one time before all endpoint
export class Ctrl {
@Get('/')
@UseBefore(Middleware2)
get() { }
}
1
2
3
4
5
6
7
8
2
3
4
5
6
7
8
- Session & cookies
- Passport.js
- TypeORM
- Mongoose
- GraphQL
- Socket.io
- Swagger
- AJV
- Multer
- Serve static files
- Templating
- Throw HTTP Exceptions
- Customize 404
- AWS
- Jest
- Seq
- Controllers
- Providers
- Model
- Converters
- Middlewares
- Pipes
- Interceptors
- Authentication
- Hooks
- Injection scopes
- Custom providers
- Custom endpoint decorator
- Testing