The core kernel functionality for Raptor.
Classes
An error used primarily in 400 bad request errors.
The Bun server implementation for Raptor.
- serve(): voidhandler: RequestHandler,options?: { port?: number; hostname?: string; }
Start the server with the given request handler.
An error used primarily in 409 conflict request errors.
- status: number
The HTTP status code associated with the error.
HTTP content type negotiation service.
- isAcceptable(): booleanrequest: Request,contentType: string
Check if a content-type is acceptable based on the accept header.
- negotiate(request: Request): string
Detect the most appropriate content type for a request based on headers.
- parseAcceptHeader(header: string): string[]
Parse Accept header and return types sorted by quality value and specificity.
The context definition.
- connection: ConnInfo
The connection the request arrived on, where the adapter supplied one.
- error: HttpError | Error
An error caught by the system.
- hasContentType(): boolean
Check if the response has a content-type set.
- request: Request
The current HTTP request.
- response: Response
The current HTTP response.
The response manager takes the response body and processes it into a valid HTTP response.
- getTypeKey(body: any): string
Determine the type key for a given body.
- process(): Promise<Response>body: any,context: Context
Process a body into a valid Response object.
- register(): voidtype: string,processor: ResponseProcessor
Add a new processor to the response manager.
The Deno server implementation for Raptor.
- serve(): voidhandler: RequestHandler,options?: { port?: number; hostname?: string; }
Start the server with the given request handler.
The plain text processor for HTTP responses.
- process(): Responsebody: any,context: Context
Handle the response and process plain text if found.
An error used primarily in 403 forbidden request errors.
- status: number
The HTTP status code associated with the error.
An error used primarily in 410 gone request errors.
- status: number
The HTTP status code associated with the error.
The root initialiser for the framework.
- add(middleware: Middleware): this
Add new middleware to the container.
- catch(handler: ErrorHandler): this
Add custom error handling middleware.
- getConfig(): Config
Get the configured kernel config.
- getResponseManager(): ResponseManager
Get the currently registered response manager.
- getServerManager(): ServerManager
Get the currently registered server manager.
- initialiseDefaultConfig(): Config
Initialises the default kernel config.
- listen(): void
Alias method for "serve".
- respond(): Promise<Response>request: Request,connection?: ConnInfo
Handle an HTTP request and respond.
- serve(): void
Serve the application.
- setResponseManager(manager: ResponseManager): this
Set or override the response manager for the kernel.
- setServerManager(manager: ServerManager): this
Set or override the server manager for the kernel.
- use(middleware: Middleware): this
Alias method for "add".
- getServerAdapter(): string
Detect the runtime and return correct adapter.
- register(): voidname: string,adapter: ServerAdapter
Register a new adapter to the server manager.
- serve(): voidhandler: RequestHandler,options?: { port?: number; hostname?: string; }
Start the server with the given request handler.
An error used primarily in 405 method not allowed request errors.
- status: number
The HTTP status code associated with the error.
The Node server implementation for Raptor.
- serve(): Promise<void>handler: RequestHandler,options?: { port?: number; hostname?: string; }
Start the server with the given request handler.
An error used primarily in 406 not acceptable request errors.
- status: number
The HTTP status code associated with the error.
An error used primarily in 404 not found request errors.
- status: number
The HTTP status code associated with the error.
The object processor for HTTP responses.
- process(): Responsebody: any,context: Context
Handle the response and process objects if found.
An error used primarily in 408 request timeout errors.
- status: number
The HTTP status code associated with the error.
The Response processor for HTTP responses.
- process(): Responseresponse: any,_context: Context
Handle the response and process if found.
An error used primarily in 500 server errors.
- status: number
The HTTP status code associated with the error.
The HTML processor for HTTP responses.
- process(): Responsebody: any,context: Context
Handle the response and process HTML if found.
An error used primarily in 418 gone request errors.
- status: number
The HTTP status code associated with the error.
An error used primarily in 429 gone request errors.
- status: number
The HTTP status code associated with the error.
An error used primarily in 422 unprocessable entity request errors.
Functions
Canonicalise an IP address into one stable text form.
Resolve the address of the client that made this request.
Compile a trust policy, validating it up front.
Build connection details from a runtime-reported peer address.
Interfaces
Config which can be used to change kernel functionality.
- errorHandler: ErrorHandler | null
The custom error handler for catching and responding to system errors.
- hostname: string
The hostname the kernel will use to serve the appliation.
- middleware: Middleware[]
Middleware stack, providing a way to add middleware to the kernel.
- port: number
The port the kernel will use to serve the application.
- response: { manager?: ResponseManager; processors?: Record<string, ResponseProcessor>; }
Response configuration, providing a way to override the kernel's response management.
- server: { manager?: ServerManager; }
Server configuration, providing a way to override the kernel's server management.
- strictContentNegotiation: boolean
Enable strict RFC 7231 content negotiation.
Manages the processing of response bodies into HTTP Response objects.
An HTTP response body processor.
- process(): Promise<Response> | Responsebody: any,context: Context
Handle the response body and process.
- serve(): void | Promise<void>handler: RequestHandler,options?: { port?: number; hostname?: string; }
Start the server with the given request handler.
Manages the serving of applications.
Type Aliases
The request handler a server adapter drives. connection is optional, as not
every runtime exposes one.
How far to trust X-Forwarded-For when resolving a client address.
Decides whether the hop at index in the chain may be trusted.
Variables
A convenient helper for dealing with response body types.