import * as oak from "https://deno.land/x/oak@v14.1.0/middleware/serve.ts";
Middleware that converts the oak specific context to a Fetch API standard
Request
and Response
along with a modified context
providing some of the oak functionality. This is intended to make it easier
to adapt code to work with oak.
There are two functions which will "wrap" a handler that operates off a
Fetch API request and response and return an oak middleware. The
serve
is designed for using with the Application
.use()
method, while route
is designed for using with the
Router
.
[!IMPORTANT] This is not intended for advanced use cases that are supported by oak, like integrated cookie management, web sockets and server sent events.
Also, these are designed to be very deterministic request/response handlers versus a more nuanced middleware stack which allows advanced control. Therefore there is no
next()
.For these advanced use cases, create middleware without the wrapper.
Classes
The context associated with serve middleware requests on a router. | |
The context associated when dealing with serve middleware requests on an application. |
Functions
Wrap a handler function to generate middleware that can be used with an oak
|