UNPKG

@tdb/web

Version:

Common condiguration for serving a web-site and testing web-based UI components.

29 lines (28 loc) 1.15 kB
import { RequestHandler } from 'express'; import { IWebApp } from './common'; import { IWebAppOptions, RedirectPath } from './types'; export declare class WebApp implements IWebApp { static init(options?: IWebAppOptions): WebApp; isStarted: boolean; readonly dev: boolean; readonly port: number; readonly silent: boolean; readonly staticPath: string; readonly dir: string; readonly router: import("express-serve-static-core").Router; private _server; private _render; private constructor(); private readonly server; private restHandler; get: (url: string, handler: RequestHandler) => this; put: (url: string, handler: RequestHandler) => this; post: (url: string, handler: RequestHandler) => this; delete: (url: string, handler: RequestHandler) => this; use(...handlers: Array<RequestHandler | IWebApp>): this; redirect(fromPath: string, toPath: RedirectPath | string): this; file(urlPath: string, filePath: string): this; static(urlPath: string, dirPath: string): this; render(urlPath: string, pagePath?: string): this; start(port?: number): Promise<this>; }