import { type Server } from 'node:http'; import type { Handler, Middleware, NextFunction, UseMethodParams } from '@tinyhttp/router'; import { Router } from '@tinyhttp/router'; import type { TemplateEngineOptions } from './index.js'; import type { ErrorHandler } from './onError.js'; import type { Request } from './request.js'; import type { Response } from './response.js'; import type { AppConstructor, AppInterface, AppRenderOptions, AppSettings, TemplateEngine } from './types.js'; /** * `App` class - the starting point of tinyhttp app. * * With the `App` you can: * * use routing methods and `.use(...)` * * set no match (404) and error (500) handlers * * configure template engines * * store data in locals * * listen the http server on a specified port * * In case you use TypeScript, you can pass custom types to this class because it is also a generic class. * * Example: * * ```ts * interface CoolReq extends Request { * genericsAreDope: boolean * } * * const app = App() * ``` */ export declare class App extends Router implements AppInterface { #private; middleware: Middleware[]; locals: Record; noMatchHandler: Handler; onError: ErrorHandler; settings: AppSettings; engines: Record; applyExtensions?: Handler; attach: (req: Req, res: Res, next?: NextFunction) => void; cache: Record; constructor(options?: AppConstructor); set(setting: K, value: AppSettings[K]): this; enable(setting: K): this; enabled(setting: K): boolean; disable(setting: K): this; path(): any; engine(ext: string, fn: TemplateEngine): this; render(name: string, data?: Record, options?: AppRenderOptions, cb?: (err: unknown, html?: unknown) => void): void; use(...args: UseMethodParams>): this; route(path: string): App; handler(req: Req, res: Res, next?: NextFunction): void; listen(port?: number, cb?: () => void, host?: string): Server; } //# sourceMappingURL=app.d.ts.map