Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/oak/middleware.ts>MiddlewareObject

A middleware framework for handling HTTP with Deno, Node, Bun and Cloudflare Workers 🐿️ 🦕
Very Popular
Latest
interface MiddlewareObject
import { type MiddlewareObject } from "https://deno.land/x/oak@v17.1.3/middleware.ts";

Middleware objects allow encapsulation of middleware along with the ability to initialize the middleware upon listen.

Type Parameters

optional
S extends State = Record<string, any>
optional
T extends Context<S> = Context<S>

Properties

optional
init: () => Promise<unknown> | unknown

Optional function for delayed initialization which will be called when the application starts listening.

Methods

handleRequest(context: T, next: Next): Promise<unknown> | unknown

The method to be called to handle the request.