Skip to main content


A middleware framework for handling HTTP with Deno 🐿️ 🦕
Extremely Popular
Go to Latest
import * as oak from "";


The base class that all derivative HTTP extend, providing a status and an expose property.

A cryptographic key chain which allows signing of data to prevent tampering, but also allows for easy key rotation without needing to re-sign the data.


Provides an way to manage cookies in a request and response on the server as a single iterable collection, as well as the ability to sign and verify cookies to prevent tampering.

An event which contains information which will be sent to the remote connection and be made available in an EventSource as an event. A server creates new events and dispatches them on the target which will then be sent to a client.

An implementation of ServerSentEventTarget that provides a readable stream as a body of a response to establish a connection to a client.

A representation of user agent string, which can be used to determine environmental information represented by the string. All properties are determined lazily.


Standard HTTP status codes.


A namespace that contains each error constructor. Each error extends HTTPError and provides .status and .expose properties, where the .status will be an error Status value and .expose indicates if information, like a stack trace, should be shared in the response.

A record of all the status codes text.


Returns an array of media types accepted by the request, in order of preference. If there are no media types supplied in the request, then any media type selector will be returned.

Returns an array of content encodings accepted by the request, in order of preference. If there are no encoding supplied in the request, then ["*"] is returned, implying any encoding is accepted.

Returns an array of languages accepted by the request, in order of preference. If there are no languages supplied in the request, then ["*"] is returned, imply any language is accepted.

Make an assertion, error will be thrown if expr does not have truthy value.

Return the last portion of a path. Trailing directory separators are ignored, and optional suffix is removed.

Calculate an ETag for an entity. When the entity is a specific set of data it will be fingerprinted as a "strong" tag, otherwise if it is just file information, it will be calculated as a weak tag.

Compile a string to a template function for the path.

Concatenate an array of Uint8Arrays.

Given an extension or media type, return a full Content-Type or Content-Disposition header value.

Copy bytes from the src array to the dst array. Returns the number of bytes copied.

A factory function which provides a way to create errors. It takes up to 3 arguments, the error Status, an message, which defaults to the status text and error options, which includes the expose property to set the .expose value on the error.

Converts data into a base64-encoded string.

Return the extension of the path with leading period.

A helper function that takes the value from the If-Match header and a calculated etag for the target. By using strong comparison, return true if the values match, otherwise false.

A helper function that takes the value from the If-None-Match header and a calculated etag for the target entity and returns false if the etag for the entity matches the supplied value, otherwise true.

Verifies whether provided path is absolute

A type guard that determines if the status code is an error.

A type guard that determines if the value is an HttpError or not.

A type guard that determines if the status code is a redirection.

Join all given a sequence of paths,then normalizes the resulting path.

Determines if the provided media type matches one of the supplied media types. If there is a match, the matched media type is returned, otherwise undefined is returned.

Allows merging of various sources of headers into a final set of headers which can be used in a Response.

Normalize the path, resolving '..' and '.' segments. Note that resolving these segments does not necessarily mean that all will be eliminated. A '..' at the top-level will be preserved, and an empty path is canonically '.'.

Return a ParsedPath object of the path.

Create path match function from path-to-regexp spec.

Parse a string for the raw tokens.

Normalize the given path string, returning a regular expression.

Read Reader r until EOF (null) and resolve to the content as Uint8Array.

When checking the values of cryptographic hashes are equal, default comparisons can be susceptible to timing based attacks, where attacker is able to find out information about the host system by repeatedly checking response times to equality comparisons of values.

Returns the media type associated with the file extension. Values are normalized to lower case and matched irrespective of a leading ..


Options for calculate.

Just the part of Deno.FileInfo that is required to calculate an ETag, so partial or user generated file information can be passed.

Metadata about a key.

Type Aliases

An HTTP status that is an error (4XX and 5XX).

A type representing string literals of each of the common HTTP method.

An HTTP status that is a redirect (3XX).