Skip to content

UseBefore

@tsed/platform-middlewares

Usage

typescript
import { UseBefore } from "@tsed/platform-middlewares";

See /packages/platform/platform-middlewares/src/types/decorators/useBefore.ts.

Overview

ts
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.

typescript
@Controller('/')
@UseBefore(Middleware1) // called only one time before all endpoint
export class Ctrl {

   @Get('/')
   @UseBefore(Middleware2)
   get() { }
}

Released under the MIT License.