Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Module

x/middleware/mod.ts>default

If you're gonna implement middlewares, you should do it right! ;)
Latest
class default
import { default } from "https://deno.land/x/middleware@1.2.0/mod.ts";

An object that allows for adding and running middleware.

Properties

readonly
ondiagnostics: Event<[Diagnostics<Callback>]>

An event that is fired after all middlewares of this this object has been ran.

Methods

__createNextFunction(
diagnostics: Diagnostics<Callback>,
position: number,
args: [...Parameters<Callback>, NextFn | undefined | void],
lastNext?: NextFn,
)
run(...args: [...Parameters<Callback>, NextFn | undefined | void]): Promise<void | Diagnostics<Callback>>

Run the middlewares stored on this object.

runAndThen(lastNext?: NextFn, ...args: [...Parameters<Callback>, NextFn | undefined | void]): Promise<void | Diagnostics<Callback>>

Run the middlewares stored on this object and then pass a custom last next function.

unuse(...args: MiddlewareCallback<Callback>[]): this

Add middlewares.

use(...args: MiddlewareCallback<Callback>[]): this

Add middlewares.

Static Methods

isMiddleware(value: unknown): boolean

Check if a value is a valid middleware.