Skip to main content

@oak/oak@17.1.3
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
4 weeks ago (17.1.3)

default

A middleware framework for handling HTTP with Deno CLI, Deno Deploy, Cloudflare Workers, Node.js, and Bun.

c
Application

A class which registers middleware (via .use()) and then processes inbound requests against that middleware (via .listen()).

I
ApplicationOptions

Available options that are used when creating a new instance of Application.

T
BodyType
No documentation available
f
composeMiddleware

Compose multiple middleware functions into a single middleware function.

c
Context

Provides context about the current request and response to middleware functions, and the current instance being processed is the first argument provided a Middleware function.

I
ContextSendOptions

Options that can be supplied when using the .send() method.

N
etag

A collection of oak specific APIs for management of ETags.

f
etag.factory

Create middleware that will attempt to decode the response.body into something that can be used to generate an ETag and add the ETag header to the response.

f
etag.getEntity

For a given Context, try to determine the response body entity that an ETag can be calculated from.

c
HttpServerNative

The oak abstraction of the Deno native HTTP server which is used internally for handling native HTTP requests. Generally users of oak do not need to worry about this class.

T
ListenOptions

Options which can be specified when listening.

I
ListenOptionsBase

Base interface for application listening options.

T
ListenOptionsTls

Interface options when listening on TLS.

I
Middleware

Middleware are functions which are chained together to deal with requests.

I
MiddlewareObject

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

T
MiddlewareOrMiddlewareObject

Type that represents Middleware or MiddlewareObject.

c
NativeRequest

An internal oak abstraction for handling a Deno native request. Most users of oak do not need to worry about this abstraction.

T
Next

A function for chaining middleware.

f
proxy

Middleware that provides a back-to-back proxy for requests.

I
ProxyOptions

Options which can be specified on the proxy middleware.

v
REDIRECT_BACK

A symbol that indicates to response.redirect() to attempt to redirect back to the request referrer. For example:

c
Request

An interface which provides information about the current request. The instance related to the current request is available on the Context's .request property.

c
Response

An interface to control what response will be sent when the middleware finishes processing the request.

I
Route

The internal abstraction of a route used by the oak Router.

f
route

Wrap a handler function to generate middleware that can be used with an oak Router. This allows the handler to deal with a Fetch API standard Request and return a standard Response.

c
RouteContext

The context associated with serve middleware requests on a router.

T
RouteParams

A dynamic type which attempts to determine the route params based on matching the route string.

c
Router

An interface for registering middleware that will run when certain HTTP methods and paths are requested, as well as provides a way to parameterize parts of the requested path.

I
RouterAllowedMethodsOptions

Options which can be specified when calling the .allowedMethods() method on a Router instance.

I
RouterContext

The context passed router middleware.

I
RouterMiddleware

The interface that Router middleware should adhere to.

I
RouterOptions

Options which can be specified when creating a new instance of a Router.

I
RouterParamMiddleware

Middleware that will be called by the router when handling a specific parameter, which the middleware will be called when a request matches the route parameter.

f
send

Asynchronously fulfill a response with a file from the local file system.

I
SendOptions

Options which can be specified when using the send middleware.

f
serve

Wrap a handler function to generate middleware that can be used with an oak Application. This allows the handler to deal with a Fetch API standard Request and return a standard Response.

c
ServeContext

The context associated when dealing with serve middleware requests on an application.

I
ServerConstructor

The abstract constructor interface that custom servers need to adhere to when using with an Application.

T
State

The base type of state which is associated with an application or context.

N
testing

A collection of utility APIs which can make testing of an oak application easier.

f
testing.createMockApp

Creates a mock of Application.

f
testing.createMockContext

Create a mock of Context or RouterContext.

f
testing.createMockNext

Creates a mock next() function which can be used when calling middleware.

I
testing.MockContextOptions

Options that can be set in a mock context.

v
testing.mockContextState

Allows external parties to modify the context state.

application

Contains the core concept of oak, the middleware application. Typical usage is the creation of an application instance, registration of middleware, and then starting to listen for requests.

c
Application

A class which registers middleware (via .use()) and then processes inbound requests against that middleware (via .listen()).

c
ApplicationCloseEvent

An event that occurs when the application closes.

c
ApplicationErrorEvent

An event that occurs when an application error occurs.

c
ApplicationListenEvent

An event that occurs when the application starts listening for requests.

I
ApplicationOptions

Available options that are used when creating a new instance of Application.

T
ListenOptions

Options which can be specified when listening.

I
ListenOptionsBase

Base interface for application listening options.

T
ListenOptionsTls

Interface options when listening on TLS.

T
State

The base type of state which is associated with an application or context.

body

Contains the oak abstraction to represent a request Body.

c
Body

An object which encapsulates information around a request body.

T
BodyType
No documentation available

context

Contains the Context class which is the context that is provided to middleware.

c
Context

Provides context about the current request and response to middleware functions, and the current instance being processed is the first argument provided a Middleware function.

I
ContextOptions

Options that can be supplied when creating a Context

I
ContextSendOptions

Options that can be supplied when using the .send() method.

etag

A collection of oak specific APIs for management of ETags.

f
factory

Create middleware that will attempt to decode the response.body into something that can be used to generate an ETag and add the ETag header to the response.

f
getEntity

For a given Context, try to determine the response body entity that an ETag can be calculated from.

http_server_bun

The abstraction that oak uses when dealing with requests and responses within the Bun runtime that leverages the built in HTTP server.

c
Server

An implementation of the oak server abstraction for handling requests on Bun using the built in Bun http server.

http_server_native

The abstraction that oak uses when dealing with requests and responses within the Deno runtime.

c
Server

The oak abstraction of the Deno native HTTP server which is used internally for handling native HTTP requests. Generally users of oak do not need to worry about this class.

http_server_node

The abstraction that oak uses when dealing with requests and responses within the Node.js runtime.

T
IncomingMessage
No documentation available
c
Server
No documentation available

middleware

The internal middleware interfaces and abstractions used by oak.

f
compose

Compose multiple middleware functions into a single middleware function.

f
isMiddlewareObject

A type guard that returns true if the value is MiddlewareObject.

I
Middleware

Middleware are functions which are chained together to deal with requests.

I
MiddlewareObject

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

T
MiddlewareOrMiddlewareObject

Type that represents Middleware or MiddlewareObject.

T
Next

A function for chaining middleware.

proxy

Middleware for oak that allows back-to-back proxies of requests to be used.

f
proxy

Middleware that provides a back-to-back proxy for requests.

I
ProxyOptions

Options which can be specified on the proxy middleware.

request

Contains the Request abstraction used by oak.

c
Request

An interface which provides information about the current request. The instance related to the current request is available on the Context's .request property.

response

Contains the Response abstraction used by oak.

v
REDIRECT_BACK

A symbol that indicates to response.redirect() to attempt to redirect back to the request referrer. For example:

c
Response

An interface to control what response will be sent when the middleware finishes processing the request.

T
ResponseBody

The various types of bodies supported when setting the value of .body on a Response

T
ResponseBodyFunction

A function that when invoked returns or resolves to a ResponseBody.

router

Contains the router of oak. Typical usage is the creation of an application instance, the creation of a router instance, registration of route middleware, registration of router with the application, and then starting to listen for requests.

c
Layer

An internal class used to group together middleware when using multiple middlewares with a router.

I
Route

The internal abstraction of a route used by the oak Router.

T
RouteParams

A dynamic type which attempts to determine the route params based on matching the route string.

c
Router

An interface for registering middleware that will run when certain HTTP methods and paths are requested, as well as provides a way to parameterize parts of the requested path.

I
RouterAllowedMethodsOptions

Options which can be specified when calling the .allowedMethods() method on a Router instance.

I
RouterContext

The context passed router middleware.

I
RouterMiddleware

The interface that Router middleware should adhere to.

I
RouterOptions

Options which can be specified when creating a new instance of a Router.

I
RouterParamMiddleware

Middleware that will be called by the router when handling a specific parameter, which the middleware will be called when a request matches the route parameter.

send

Contains the send function which can be used to send static assets while supporting a range of HTTP capabilities.

f
send

Asynchronously fulfill a response with a file from the local file system.

I
SendOptions

Options which can be specified when using the send middleware.

serve

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.

f
route

Wrap a handler function to generate middleware that can be used with an oak Router. This allows the handler to deal with a Fetch API standard Request and return a standard Response.

c
RouteContext

The context associated with serve middleware requests on a router.

f
serve

Wrap a handler function to generate middleware that can be used with an oak Application. This allows the handler to deal with a Fetch API standard Request and return a standard Response.

c
ServeContext

The context associated when dealing with serve middleware requests on an application.

testing

A collection of utility APIs which can make testing of an oak application easier.

f
createMockApp

Creates a mock of Application.

f
createMockContext

Create a mock of Context or RouterContext.

f
createMockNext

Creates a mock next() function which can be used when calling middleware.

I
MockContextOptions

Options that can be set in a mock context.

v
mockContextState

Allows external parties to modify the context state.