bunway
Version:
Express-style routing toolkit built natively for Bun.
35 lines • 1.21 kB
TypeScript
import { type JsonParserOptions, type ResolvedBodyParserOptions, type TextParserOptions, type UrlencodedParserOptions } from "../config";
import type { Handler } from "../core/router";
/**
* Parse `application/json` requests.
*
* ```ts
* app.use(json());
* app.use(json({ limit: 2 * 1024 * 1024, type: [/json$/, "application/vnd.api+json"] }));
* ```
*/
export declare function json(options?: JsonParserOptions): Handler;
/**
* Parse `application/x-www-form-urlencoded` bodies (HTML form submissions).
*
* ```ts
* app.use(urlencoded());
* app.use(urlencoded({ limit: 64 * 1024 }));
* ```
*/
export declare function urlencoded(options?: UrlencodedParserOptions): Handler;
/**
* Parse plain text (`text/plain`) payloads.
*
* ```ts
* app.use(text());
* app.use(text({ type: /text\/(plain|csv)/ }));
* ```
*/
export declare function text(options?: TextParserOptions): Handler;
/**
* Automatically parse the request body using the per-request configuration.
* Used internally by the router to provide sensible defaults.
*/
export declare function createAutoBodyParser(resolveConfig?: (ctx: Parameters<Handler>[0]) => ResolvedBodyParserOptions): Handler;
//# sourceMappingURL=bodyParser.d.ts.map