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

    Interface IWebRouter<APP_STATE, ROUTER_STATE>

    Public interface for a Swizzy web router.

    interface IWebRouter<APP_STATE, ROUTER_STATE> {
        name: string;
        path: string;
        getState(): ROUTER_STATE;
        initialize(props: IWebRouterInitProps<APP_STATE>): Promise<void>;
        router(): any;
        toJson(): any;
        toString(): string;
        uninstall(props: UninstallRouterProps): void;
    }

    Type Parameters

    • APP_STATE
    • ROUTER_STATE

    Implemented by

    Index

    Properties

    name: string

    Unique display name for this router.

    path: string

    URL path prefix for all controllers mounted on this router.

    Methods

    • Returns the current router-level state.

      Returns ROUTER_STATE

      the router state or an empty object if not yet initialized

    • Initializes the router, setting up controllers and middleware. Must be called before router().

      Parameters

      Returns Promise<void>

    • Returns the underlying Express router. Throws if initialize has not been called.

      Returns any

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

      Returns any

      JSON representation of this router

    • Returns a JSON string representation of this router.

      Returns string

      stringified JSON of the router

    • Removes this router and all of its controllers/middleware from the app.

      Parameters

      Returns void