Skip to main content
Module

x/knight/mod.ts

MVC web server framework for Deno 🦕 built on Oak
Latest
import * as knight from "https://deno.land/x/knight@2.3.0/mod.ts";

Classes

A console sink that writes to the terminal using a set of colors. Formatting is fully configurable but defaults to human readable text.

c
Formatter
abstract
c
IController
abstract

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

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

c
Sink
abstract

Sink is a class that can be attached to a Logger instance. It is responsible for the actual implementation of logging to a specific destination, such as the console, or a file.

Default console logging formatter.

Enums

The logging levels of a log message.

Variables

The current timestamp in the international ISO standard for specifying dates.

Functions

Send an HTTP response with a status code of 202 (Accepted).

Send an HTTP response with a status code of 502 (Bad Gateway).

Send an HTTP response with a status code of 400 (Bad Request).

Extracts the body of a request as JSON and maps it to the given class.

======================================================================== Request helpers ========================================================================*

Send an HTTP response with a status code of 201 (Created) and the given body. Preferably return the created resource URI.

Redirect the client to the given temporary location URL with a status code of 302 (Found). The request method is changed to GET for the next request.

I'm a teapot.

Send an HTTP response with a status code of 500 (Internal Server Error).

Send an HTTP response with a status code of 204 (No Content).

Send an HTTP response with a status code of 406 (Not Acceptable).

Send an HTTP response with a status code of 404 (Not Found).

Send an HTTP response with a status code of 501 (Not Implemented).

Send an HTTP response with a status code of 200 (OK) and the given body.

Redirect the client to the given permanent location URL with a status code of 301 (Moved Permanently). This and all future requests should be directed to the given URI. (Cached in the browser)

The resource requested has been definitively moved to the location URL. A browser redirects to this page and search engines update their links to the resource.

Redirect the client to the given temporary location URL with a status code of 307 (Temporary Redirect). The request method is not allowed to be changed when reissuing the original request.

Send an HTTP response with a status code of 503 (Service Unavailable).

Send an HTTP response with a status code of 401 (Unauthorized).

Type Aliases

Knights own router context type. This is a custom type that extends the Oak Context.

Knights own router endpoint parameter type. This is a custom type that extends the Oak RouteParams type.