Options
All
  • Public
  • Public/Protected
  • All
Menu

@neoskop/nem

Index

Modules

Classes

Interfaces

Type aliases

Variables

Functions

Type aliases

SSEErrorHandler

SSEErrorHandler: function

Type declaration

    • (sse: SSE, options: object): void | Promise<void>
    • Parameters

      • sse: SSE
      • options: object
        • request: Request
        • response: Response
        • result: Observable<any>
        • write: SSEWrite

      Returns void | Promise<void>

SSEWrite

SSEWrite: function

Type declaration

    • (data: object): void
    • Parameters

      • data: object
        • Optional data?: string | any
        • Optional event?: undefined | string
        • Optional id?: string | number
        • Optional retry?: undefined | number

      Returns void

Variables

Const APP

APP: InjectionToken<Application> = new InjectionToken<Application>('Express Application')

Provides the express Application

Const BOOTSTRAP_LISTENER_AFTER

BOOTSTRAP_LISTENER_AFTER: InjectionToken<Function[]> = new InjectionToken<Function[]>('Bootstrap Listener After')

Provides an array of functions to call after the root module is created

Const BOOTSTRAP_LISTENER_BEFORE

BOOTSTRAP_LISTENER_BEFORE: InjectionToken<Function[]> = new InjectionToken<Function[]>('Bootstrap Listener Before')

Provides an array of functions to call before the root module is created

Const ERROR_HANDLER

ERROR_HANDLER: InjectionToken<ErrorRequestHandler> = new InjectionToken<ErrorRequestHandler>('ErrorHandler')

Provides the default error handler

see

{@link defaultErrorHandler}

Const MIDDLEWARE_AFTER

MIDDLEWARE_AFTER: InjectionToken<(IMiddleware | RequestHandler)[]> = new InjectionToken<(IMiddleware|RequestHandler)[]>('Middleware After')

Provides the middleware to invoke after to controller action handler

Const MIDDLEWARE_BEFORE

MIDDLEWARE_BEFORE: InjectionToken<(IMiddleware | RequestHandler)[]> = new InjectionToken<(IMiddleware|RequestHandler)[]>('Middleware Before')

Provides the middleware to invoke before to controller action handler

Const ROUTER

ROUTER: InjectionToken<Router> = new InjectionToken<Router>('Express Router')

Provides the express router for the current module/controller

Const SERVER

SERVER: InjectionToken<Server> = new InjectionToken<Server>('Http Server')

Provides the http server

Const VIEWS

VIEWS: InjectionToken<string[]> = new InjectionToken<string[]>('Views')

Provides an array of view directories

Const VIEW_ENGINE

VIEW_ENGINE: InjectionToken<string> = new InjectionToken<string>('View Engine')

Provides the name of the default view engine

Const VIEW_PREFIX

VIEW_PREFIX: InjectionToken<undefined | string> = new InjectionToken<string|undefined>('View Prefix')

Provides a path prefix for the views in the current module/controller

Functions

Const MethodFactory

  • MethodFactory(method: string): (Anonymous function)

middleware

  • middleware(middleware: Type<any> | RequestHandler, placement?: "before" | "after"): Provider
  • Provide a middleware for a controller

    example
    
    @Controller({
      providers: [
         middleware(ExampleMiddleware)
      ]
    })
    export class ExampleController {}
    

    Parameters

    • middleware: Type<any> | RequestHandler
    • Default value placement: "before" | "after" = "before"

    Returns Provider

nem

parse

viewDirectory

  • viewDirectory(dir: string): Provider
  • Provide an additional view directory

    usage
    
    nem({
      providers: [
        viewDirectory('./views')
      ]
    }).bootstrap(ExampleModule).listen(8000);
    
    
    @NemModule({
      providers: [
        viewDirectory('./views/example')
      ]
    })
    export class ExampleModule {}
    

    Parameters

    • dir: string

    Returns Provider

viewPrefix

  • viewPrefix(prefix: string): Provider
  • Provide an view prefix

    usage
    
    @NemModule({
      providers: [
        viewPrefix('example-')
      ]
    })
    export class ExampleModule {}
    
    @Controller({
      providers: [
        viewPrefix('example-')
      ]
    })
    export class ExampleController {
      @Get('/')
      @View('index')
      index() { // renders template `example-index`
        return {}
      }
    }
    

    Parameters

    • prefix: string

    Returns Provider

Generated using TypeDoc