import type { AppOptions, BunaryApp } from "./types/index.js"; /** * Create a new Bunary HTTP application instance. * * Provides a simple, chainable API for defining routes and middleware. * Objects returned from handlers are automatically serialized to JSON. * * @returns BunaryApp instance * * @example * ```ts * import { createApp } from "@bunary/http"; * * const app = createApp(); * * // Simple JSON response * app.get("/", () => ({ message: "Hello, Bunary!" })); * * // Path parameters * app.get("/users/:id", (ctx) => { * return { id: ctx.params.id }; * }); * * // Route groups * app.group("/api", (router) => { * router.get("/users", () => ({ users: [] })); * }); * * // Named routes * app.get("/users/:id", (ctx) => ({ id: ctx.params.id })).name("users.show"); * const url = app.route("users.show", { id: 123 }); * * app.listen(3000); * ``` * * @param options - Optional configuration * @param options.basePath - Base path prefix for all routes (e.g., "/api") * @typeParam TLocals — Shape of `ctx.locals`. Defaults to `Record`. * @returns BunaryApp instance * * @example * ```ts * // Without basePath * const app = createApp(); * app.get("/users", () => ({})); // Matches /users * * // With basePath * const apiApp = createApp({ basePath: "/api" }); * apiApp.get("/users", () => ({})); // Matches /api/users * * // With typed locals * interface Locals { user: User; requestId: string } * const typedApp = createApp(); * typedApp.get("/me", (ctx) => ({ user: ctx.locals.user })); // typed * ``` */ export declare function createApp>(options?: AppOptions): BunaryApp; //# sourceMappingURL=app.d.ts.map