Options
All
  • Public
  • Public/Protected
  • All
Menu

dipress

Index

Variables

container

container: Container = ...

Bootstrap Functions

ApplicationServer

  • ApplicationServer(__namedParameters: ApplicationOptions): (Constructor: ObjectConstructor<any>) => void
  • Decorator for initializing a server

    decorator

    ApplicationServer

    • Initialize the application server with controllers.
    • A new instance of app is created by default, but a pre-configured instance of express application can be used.
    • Using the verbose option logs controller and route details to the console.

    Parameters

    • __namedParameters: ApplicationOptions

    Returns (Constructor: ObjectConstructor<any>) => void

      • (Constructor: ObjectConstructor<any>): void
      • Parameters

        • Constructor: ObjectConstructor<any>

        Returns void

OnServerInit

  • OnServerInit(globalValKeyName?: string): (target: Object, key: string, descriptor: PropertyDescriptor) => void
  • decorator

    OnServerInit

    • Methods decorated with this are called before initializing the server

    Parameters

    • globalValKeyName: string = ...

    Returns (target: Object, key: string, descriptor: PropertyDescriptor) => void

      • (target: Object, key: string, descriptor: PropertyDescriptor): void
      • Parameters

        • target: Object
        • key: string
        • descriptor: PropertyDescriptor

        Returns void

OnServerStartup

  • OnServerStartup(target: Object, key: string, descriptor: PropertyDescriptor): void
  • decorator

    OnServerStartup

    • Method decorated with this is called after server is up and running.
    • The method is called with a server object parameter.
    • Can be used only on one method.

    Parameters

    • target: Object
    • key: string
    • descriptor: PropertyDescriptor

    Returns void

WildcardHandler

  • WildcardHandler(target: Object, key: string, _: PropertyDescriptor): void

Common Functions

Component

  • Component(): (constructor: ObjectConstructor<any>) => void
  • decorator

    Component

    • Initializes a class as an injectable, hence allowing injection of its object as a dependency

    Returns (constructor: ObjectConstructor<any>) => void

      • (constructor: ObjectConstructor<any>): void
      • Parameters

        • constructor: ObjectConstructor<any>

        Returns void

ErrorHandler

  • ErrorHandler(target: Object, key: string, _: PropertyDescriptor): void
  • decorator

    ErrorHandler

    • Initialize an ErrorRequestHandler for a controller.
    • Can be used once for a controller.

    Parameters

    • target: Object
    • key: string
    • _: PropertyDescriptor

    Returns void

Factory

  • Factory(target: Object, key: string, _: PropertyDescriptor): void
  • decorator

    Factory

    • Use a method as a factory - the method will be executed during app initialization and its return value, if valid, will be used for subsequent processes.

    Parameters

    • target: Object
    • key: string
    • _: PropertyDescriptor

    Returns void

Controller Functions

ALL

  • ALL(route: string): (target: Object, key: string, _: PropertyDescriptor) => void
  • decorator

    ALL

    • Use the decorated method as a handler for ALL requests to the route.

    Parameters

    • route: string

    Returns (target: Object, key: string, _: PropertyDescriptor) => void

      • (target: Object, key: string, _: PropertyDescriptor): void
      • Parameters

        • target: Object
        • key: string
        • _: PropertyDescriptor

        Returns void

DELETE

  • DELETE(route: string): (target: Object, key: string, _: PropertyDescriptor) => void
  • decorator

    DELETE

    • Use the decorated method as a handler for DELETE requests to the route.

    Parameters

    • route: string

    Returns (target: Object, key: string, _: PropertyDescriptor) => void

      • (target: Object, key: string, _: PropertyDescriptor): void
      • Parameters

        • target: Object
        • key: string
        • _: PropertyDescriptor

        Returns void

GET

  • GET(route: string): (target: Object, key: string, _: PropertyDescriptor) => void
  • decorator

    GET

    • Use the decorated method as a handler for GET requests to the route.

    Parameters

    • route: string

    Returns (target: Object, key: string, _: PropertyDescriptor) => void

      • (target: Object, key: string, _: PropertyDescriptor): void
      • Parameters

        • target: Object
        • key: string
        • _: PropertyDescriptor

        Returns void

InjectGlobal

  • InjectGlobal(injectableKeyName: string): (target: Object, key: string) => void
  • decorator

    InjectGlobal

    • Injects the value of a Global Varaible previously initialized by making use of the return value of method decorated with the OnServerInit decorator.

    Parameters

    • injectableKeyName: string

    Returns (target: Object, key: string) => void

      • (target: Object, key: string): void
      • Parameters

        • target: Object
        • key: string

        Returns void

POST

  • POST(route: string): (target: Object, key: string, _: PropertyDescriptor) => void
  • decorator

    POST

    • Use the decorated method as a handler for POST requests to the route.

    Parameters

    • route: string

    Returns (target: Object, key: string, _: PropertyDescriptor) => void

      • (target: Object, key: string, _: PropertyDescriptor): void
      • Parameters

        • target: Object
        • key: string
        • _: PropertyDescriptor

        Returns void

PUT

  • PUT(route: string): (target: Object, key: string, _: PropertyDescriptor) => void
  • decorator

    PUT

    • Use the decorated method as a handler for PUT requests to the route.

    Parameters

    • route: string

    Returns (target: Object, key: string, _: PropertyDescriptor) => void

      • (target: Object, key: string, _: PropertyDescriptor): void
      • Parameters

        • target: Object
        • key: string
        • _: PropertyDescriptor

        Returns void

RestController

  • RestController(routePrefix?: string): (constructor: Function) => void
  • decorator

    RestController

    • Initializes a class as a controller.

    Parameters

    • routePrefix: string = ""

    Returns (constructor: Function) => void

      • (constructor: Function): void
      • Parameters

        • constructor: Function

        Returns void

UseAfter

  • UseAfter(handlers: RequestHandler<ParamsDictionary, any, any, ParsedQs, Record<string, any>> | RequestHandler<ParamsDictionary, any, any, ParsedQs, Record<string, any>>[]): (decoratee: Object | Function, key?: string, descriptor?: PropertyDescriptor) => void
  • decorator

    UseAfter

    • Accepts a list of RequestHandler for use after an endpoint.

    Parameters

    • handlers: RequestHandler<ParamsDictionary, any, any, ParsedQs, Record<string, any>> | RequestHandler<ParamsDictionary, any, any, ParsedQs, Record<string, any>>[]

    Returns (decoratee: Object | Function, key?: string, descriptor?: PropertyDescriptor) => void

      • (decoratee: Object | Function, key?: string, descriptor?: PropertyDescriptor): void
      • Parameters

        • decoratee: Object | Function
        • Optional key: string
        • Optional descriptor: PropertyDescriptor

        Returns void

UseBefore

  • UseBefore(handlers: RequestHandler<ParamsDictionary, any, any, ParsedQs, Record<string, any>> | RequestHandler<ParamsDictionary, any, any, ParsedQs, Record<string, any>>[]): (decoratee: Object | Function, key?: string, descriptor?: PropertyDescriptor) => void
  • decorator

    UseBefore

    • Accepts a list of RequestHandler for use before an endpoint.

    Parameters

    • handlers: RequestHandler<ParamsDictionary, any, any, ParsedQs, Record<string, any>> | RequestHandler<ParamsDictionary, any, any, ParsedQs, Record<string, any>>[]

    Returns (decoratee: Object | Function, key?: string, descriptor?: PropertyDescriptor) => void

      • (decoratee: Object | Function, key?: string, descriptor?: PropertyDescriptor): void
      • Parameters

        • decoratee: Object | Function
        • Optional key: string
        • Optional descriptor: PropertyDescriptor

        Returns void

DTO-validation Functions

MaxLength

  • MaxLength(constraint: number): (target: any, key: string) => void
  • decorator

    MaxLength

    Parameters

    • constraint: number

    Returns (target: any, key: string) => void

      • (target: any, key: string): void
      • Parameters

        • target: any
        • key: string

        Returns void

MinLength

  • MinLength(constraint: number): (target: any, key: string) => void
  • decorator

    MinLength

    Parameters

    • constraint: number

    Returns (target: any, key: string) => void

      • (target: any, key: string): void
      • Parameters

        • target: any
        • key: string

        Returns void

Range

  • Range(start: number, end: number): (target: any, key: string) => void
  • decorator

    Range

    Parameters

    • start: number
    • end: number

    Returns (target: any, key: string) => void

      • (target: any, key: string): void
      • Parameters

        • target: any
        • key: string

        Returns void

Required

  • Required(): (target: any, key: string) => void
  • decorator

    Required

    Returns (target: any, key: string) => void

      • (target: any, key: string): void
      • Parameters

        • target: any
        • key: string

        Returns void

Strict

  • Strict(): (target: any, key: string) => void
  • decorator

    Strict

    Returns (target: any, key: string) => void

      • (target: any, key: string): void
      • Parameters

        • target: any
        • key: string

        Returns void

Parameters Functions

Body

  • Body(objectKey?: string): (target: Object, key: string, index: number) => void
  • decorator

    Body

    • Calls the handler with req.body

    Parameters

    • Optional objectKey: string

    Returns (target: Object, key: string, index: number) => void

      • (target: Object, key: string, index: number): void
      • Parameters

        • target: Object
        • key: string
        • index: number

        Returns void

Context

  • Context(): (target: Object, key: string, index: number) => void
  • decorator

    Context

    • Calls the handler with the req, res, next

    Returns (target: Object, key: string, index: number) => void

      • (target: Object, key: string, index: number): void
      • Parameters

        • target: Object
        • key: string
        • index: number

        Returns void

Err

  • Err(objectKey?: string): (target: Object, key: string, index: number) => void
  • decorator

    Error

    • Calls the handler with an error object

    Parameters

    • Optional objectKey: string

    Returns (target: Object, key: string, index: number) => void

      • (target: Object, key: string, index: number): void
      • Parameters

        • target: Object
        • key: string
        • index: number

        Returns void

Next

  • Next(objectKey?: string): (target: Object, key: string, index: number) => void
  • decorator

    Next

    • Calls the handler with the NextFunction

    Parameters

    • Optional objectKey: string

    Returns (target: Object, key: string, index: number) => void

      • (target: Object, key: string, index: number): void
      • Parameters

        • target: Object
        • key: string
        • index: number

        Returns void

Params

  • Params(objectKey?: string): (target: Object, key: string, index: number) => void
  • decorator

    Params

    • Calls the handler with req.params

    Parameters

    • Optional objectKey: string

    Returns (target: Object, key: string, index: number) => void

      • (target: Object, key: string, index: number): void
      • Parameters

        • target: Object
        • key: string
        • index: number

        Returns void

Query

  • Query(objectKey?: string): (target: Object, key: string, index: number) => void
  • decorator

    Query

    • Calls the handler with req.query

    Parameters

    • Optional objectKey: string

    Returns (target: Object, key: string, index: number) => void

      • (target: Object, key: string, index: number): void
      • Parameters

        • target: Object
        • key: string
        • index: number

        Returns void

Req

  • Req(objectKey?: string): (target: Object, key: string, index: number) => void
  • decorator

    Req

    • Calls the handler with the request object

    Parameters

    • Optional objectKey: string

    Returns (target: Object, key: string, index: number) => void

      • (target: Object, key: string, index: number): void
      • Parameters

        • target: Object
        • key: string
        • index: number

        Returns void

Res

  • Res(objectKey?: string): (target: Object, key: string, index: number) => void
  • decorator

    Res

    • Calls the handler with the response object

    Parameters

    • Optional objectKey: string

    Returns (target: Object, key: string, index: number) => void

      • (target: Object, key: string, index: number): void
      • Parameters

        • target: Object
        • key: string
        • index: number

        Returns void

Generated using TypeDoc