serwist
Version:
A Swiss Army knife for service workers.
16 lines • 1.03 kB
TypeScript
import { Route } from "../Route.js";
import type { HTTPMethod } from "../constants.js";
import type { RouteHandler, RouteMatchCallback } from "../types.js";
/**
* Parses a `RegExp`, string, or function with a caching strategy into a {@linkcode Route}. This is for
* when you want to create a {@linkcode Route}, but you don't want to register it just yet: sometimes
* you want to call {@linkcode Route.setCatchHandler} first, for example.
*
* @param capture If the capture param is a {@linkcode Route} object, all other arguments will be ignored.
* @param handler A callback function that returns a promise resulting in a response.
* This parameter is required if `capture` is not a {@linkcode Route} object.
* @param method The HTTP method to match the route against. Defaults to `'GET'`.
* @returns The generated {@linkcode Route}.
*/
export declare const parseRoute: (capture: RegExp | string | RouteMatchCallback | Route, handler?: RouteHandler, method?: HTTPMethod) => Route;
//# sourceMappingURL=parseRoute.d.ts.map