docs: improve docs a bit more
This commit is contained in:
parent
58139b078d
commit
b7011f9659
6 changed files with 38 additions and 1 deletions
|
@ -1,3 +1,8 @@
|
|||
/**
|
||||
* Default handler for returning Markdown as either HTML or raw Markdown.
|
||||
* @module
|
||||
*/
|
||||
|
||||
import * as path from '@std/path';
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
/**
|
||||
* Handles requests for static files.
|
||||
* @module
|
||||
*/
|
||||
|
||||
import * as path from '@std/path';
|
||||
import * as media_types from '@std/media-types';
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue