Skip to main content
This release is 6 versions behind 17.1.3 — the latest version of @oak/oak. Jump to latest

@oak/oak@16.0.0
Built and signed on GitHub Actions

A middleware framework for handling HTTP with Deno, Node.js, Bun and Cloudflare Workers 🐿️🦕🥟⚙️

This package works with Cloudflare Workers, Node.js, Deno, Bun
This package works with Cloudflare Workers
This package works with Node.js
This package works with Deno
This package works with Bun
JSR Score
100%
Published
8 months ago (16.0.0)
interface MiddlewareObject

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

Type Parameters

S extends State = Record<string, any>
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.

Add Package

deno add jsr:@oak/oak

Import symbol

import { type MiddlewareObject } from "@oak/oak/middleware";

---- OR ----

Import directly with a jsr specifier

import { type MiddlewareObject } from "jsr:@oak/oak/middleware";

Add Package

npx jsr add @oak/oak

Import symbol

import { type MiddlewareObject } from "@oak/oak/middleware";

Add Package

yarn dlx jsr add @oak/oak

Import symbol

import { type MiddlewareObject } from "@oak/oak/middleware";

Add Package

pnpm dlx jsr add @oak/oak

Import symbol

import { type MiddlewareObject } from "@oak/oak/middleware";

Add Package

bunx jsr add @oak/oak

Import symbol

import { type MiddlewareObject } from "@oak/oak/middleware";