UNPKG

@api.global/typedserver

Version:

A TypeScript-based project for easy serving of static files with support for live reloading, compression, and typed requests.

38 lines (37 loc) 1.33 kB
import { type IServerOptions, TypedServer } from '../classes.typedserver.js'; import type { Request, Response } from '../index.js'; import * as plugins from '../plugins.js'; import * as servertools from '../servertools/index.js'; export interface IUtilityWebsiteServerConstructorOptions { addCustomRoutes?: (serverArg: servertools.Server) => Promise<any>; appSemVer?: string; domain: string; serveDir: string; feedMetadata: IServerOptions['feedMetadata']; } /** * the utility website server implements a best practice server for websites * It supports: * * live reload * * compression * * serviceworker * * pwa manifest */ export declare class UtilityWebsiteServer { options: IUtilityWebsiteServerConstructorOptions; typedserver: TypedServer; typedrouter: plugins.typedrequest.TypedRouter; constructor(optionsArg: IUtilityWebsiteServerConstructorOptions); /** * */ start(portArg?: number): Promise<void>; stop(): Promise<void>; /** * allows you to hanlde requests from other server instances without the need to listen for yourself * note smartexpress allows you start the instance wuith passing >>false<< as second parameter to .start(); * @param req * @param res */ handleRequest(req: Request, res: Response): Promise<void>; }