import { TWooksHttpOptions, WooksHttp } from '@wooksjs/event-http'; import { Application, NextFunction } from 'express'; import { IncomingMessage, ServerResponse } from 'http'; interface TWooksExpressOptions extends TWooksHttpOptions { /** * When true, respond with 404 for unmatched Wooks routes * instead of passing to the next Express middleware. * @default false */ raise404?: boolean; } /** * Express adapter for Wooks. * * Uses Wooks routing and composables on top of an Express application. * Registers itself as Express middleware — requests matching Wooks routes * are handled by Wooks; unmatched requests fall through to Express. * * @example * ```ts * import express from 'express' * import { WooksExpress } from '@wooksjs/express-adapter' * import { useRouteParams } from '@wooksjs/event-http' * * const app = express() * const wooks = new WooksExpress(app) * * wooks.get('/hello/:name', () => { * const { get } = useRouteParams() * return { hello: get('name') } * }) * * app.listen(3000) * ``` */ declare class WooksExpress extends WooksHttp { protected expressApp: Application; protected expressOpts: TWooksExpressOptions; constructor(expressApp: Application, opts?: TWooksExpressOptions); /** * Start the Express server and return a promise that resolves when listening. */ listen(...args: unknown[]): Promise; /** * Returns Express middleware that routes requests through Wooks. * Matched routes are handled by Wooks; unmatched requests call `next()`. */ getExpressMiddleware(): (req: IncomingMessage, res: ServerResponse, next: NextFunction) => void; } export { WooksExpress }; export type { TWooksExpressOptions };