Skip to content

UseBeforeEach

@tsed/platform-middlewares

Usage

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

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

Overview

ts
function UseBeforeEach(...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('/')
@UseBeforeEach(Middleware1)  // Called before each endpoint
export class Ctrl {

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

Released under the MIT License.