Skip to main content
Module

x/peko/mod.ts

Featherweight HTTP routing and utilities for the stateless edge 🐣⚡
Go to Latest
import * as peko from "https://deno.land/x/peko@2.0.0/mod.ts";

Classes

Utility class for running middleware functions in a cascade

Crypto class, generates hashes and signs and verifies JWTs using CyptoKey (generated from string or provided).

Response caching class, provides memoize method to be used on handlers or next() in middleware

Variables

Auth middleware, uses Crypto utility class to verify JWTs

Cache and serve responses using provided ResponseCache

Generic request info logging middleware. Awaits next() so log happens post request handling.

Merge source headers into base headers and return base

Recursively create an array of routes with the static handler for all files/sub-directories in the provided directory.

Streams type "send" CustomEvents from provided EventTarget to Response body. Routes using this handler should be requested via the EventSource browser API.

Generates Response with SSRData.render result in body Sets headers "Content-Type" and "ETag" to "text/html" and body hash

Generates Response body from file URL and Content-Type and ETAG headers. Optionally: provide custom headers and/or body transform fcn.