docs: improve docs a bit more

This commit is contained in:
Andy Burke 2025-06-19 15:55:35 -07:00
parent 58139b078d
commit b7011f9659
6 changed files with 38 additions and 1 deletions

View file

@ -1,15 +1,27 @@
/**
* Handles requests for which there are Typescript files that match
* and adhere to the `ROUTE_HANDLER` interface.
* @module
*/
import { walk } from '@std/fs';
import { delay } from '@std/async/delay';
import * as path from '@std/path';
import { getCookies } from '@std/http/cookie';
/** A `PRECHECK` must take a `Request` and `meta` data and return a `Response` IF THERE IS A PROBLEM. */
export type PRECHECK = (
request: Request,
meta: Record<string, any>
) => undefined | Response | Promise<undefined | Response>;
/** A `PRECHECK_TABLE` maps from HTTP methods to your `PRECHECK`s. */
export type PRECHECKS_TABLE = Record<'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH', PRECHECK>;
/** A `ROUTE_HANDLER_METHOD` must take a `Request` and `meta` data and return a `Response`. */
export type ROUTE_HANDLER_METHOD = (request: Request, meta: Record<string, any>) => Promise<Response> | Response;
/** A `ROUTE_HANDLER` can export methods for handling various HTTP requests. */
export interface ROUTE_HANDLER {
PRECHECKS?: PRECHECKS_TABLE;
GET?: ROUTE_HANDLER_METHOD;