@swizzyweb/swizzy-web-service
    Preparing search index...

    Class WebRouter<APP_STATE, ROUTER_STATE>Abstract

    Public interface for a Swizzy web router.

    Type Parameters

    • APP_STATE
    • ROUTER_STATE

    Implements

    Index

    Constructors

    Properties

    actualRouter?: IRouter

    Actual express router initialized in initialize method

    logger: ILogger<any>

    logger

    Router middleware

    name: string

    Web router name

    path: string

    URL path prefix for all controllers mounted on this router.

    state?: ROUTER_STATE
    webControllerClasses: NewWebControllerClass<ROUTER_STATE, any>[]

    Controller classes to be attached to this router

    isWebRouter: boolean = true

    Flag for if this is a webrouter, alwaus true for all web routers

    Methods

    • Returns the current router-level state.

      Returns ROUTER_STATE

      the router state, or an empty object if not yet initialized

    • Returns true if the router has already been initialized.

      Returns boolean

    • Returns the underlying Express router.

      Returns IRouter

      if initialize has not been called yet

    • Serializes the router to a plain JSON-compatible object.

      Returns {
          installedControllers: any[];
          logger: undefined;
          middleware: any[];
          name: string;
          path: string;
          stateConverter: { name: string };
          webControllerClasses: NewWebControllerClass<ROUTER_STATE, any>[];
      }

      JSON representation of this router

    • Returns a JSON string representation of this router.

      Returns string

      stringified JSON of the router