UNPKG

bunway

Version:

Express-style routing toolkit built natively for Bun.

43 lines 1.63 kB
/** * Public entry point re-exporting the bunWay factory, middleware, and types. */ import type { BodyParserOptions } from "./config"; import type { Handler } from "./core/router"; import { BunWayApp, type BunWayOptions } from "./server"; import { json, text, urlencoded } from "./middlewares/bodyParser"; interface BunwayFactory { (options?: BunWayOptions): BunWayApp; json: typeof json; urlencoded: typeof urlencoded; text: typeof text; bodyParser: (options?: BodyParserOptions) => Handler; } /** * Factory function users import. * * Example usage: * ```ts * import { bunway } from "bunway"; * const app = bunway(); * app.get("/", (ctx) => ctx.res.text("OK")); * app.listen(); * ``` * * Middleware helpers (`json`, `urlencoded`, `text`, `bodyParser`) are available * as static properties mirroring Express' API. */ export declare const bunway: BunwayFactory; export { BunWayApp, BUNWAY_DEFAULT_PORT } from "./server"; export { Router } from "./core/router"; export { WayContext, WayRequest, WayResponse } from "./core/context"; export { json, urlencoded, text } from "./middlewares/bodyParser"; export { cors } from "./middlewares/cors"; export { HttpError } from "./core/errors"; export { errorHandler } from "./middlewares/errorHandler"; export type { Handler } from "./core/router"; export type { BunWayOptions } from "./server"; export type { NextFunction } from "./core/context"; export type { BodyParserOptions } from "./config"; export type { HttpErrorOptions } from "./core/errors"; export type { ErrorHandlerOptions } from "./middlewares/errorHandler"; //# sourceMappingURL=index.d.ts.map