Vapor Documentation Beta

Classes

Application
Application.​Locks
BCrypt​Digest

Creates and verifies BCrypt hashes. Normally you will not need to initialize one of these classes and you will use the global BCrypt convenience instead.

Boot​Command

Boots the Application then exits successfully.

Routes​Command

Displays all routes registered to the Application's Router in an ASCII-formatted table.

Serve​Command

Boots the application's server. Listens for SIGINT and SIGTERM for graceful shutdown.

Endpoint​Cache

Handles the complexities of HTTP caching.

HTTPServer
CORSMiddleware

Middleware that adds support for CORS settings in request responses. For configuration of this middleware please use the CORSMiddleware.Configuration object.

Error​Middleware

Captures all errors and transforms them into an internal server error HTTP response.

File​Middleware

Serves static files from a public directory.

Route​Logging​Middleware

Emits a log message containing the request method and path to a Request's logger. The log level of the message is configurable.

Request
Response

An HTTP response from a server back to the client.

Route
Routes
Memory​Sessions.​Storage
Session

Sessions are a method for associating data with a client accessing your app.

Sessions​Middleware

Uses HTTP cookies to save and restore sessions for connecting clients.

Structures

Application.​Lifecycle
Request.​Authentication

Request helper for storing and fetching authenticated objects.

Basic​Authorization

A basic username and password.

Bearer​Authorization

A bearer token.

Application.​Caches
Application.​Caches.​Provider
Application.​Clients
Application.​Clients.​Provider
Client​Request
Client​Response
Boot​Command.​Signature

See Command.

Routes​Command.​Signature
Serve​Command.​Signature
Content​Configuration

Configures which Encoders and Decoders to use when interacting with data in HTTP messages.

Plaintext​Encoder

Encodes data as plaintext, utf8.

Application.​Core
Application.​Running
Environment.​Process

The process information of an environment. Wraps ProcessInto.processInfo.

Environment

The environment the application is running in, i.e., production, dev, etc. All Containers will have an Environment that can be used to dynamically register and configure services.

Abort

Default implementation of AbortError. You can use this as a convenient method for throwing AbortErrors without having to conform your own error-type to AbortError.

Error​Source

A source-code location.

Stack​Trace
Stack​Trace.​Frame
Application.​HTTP
Basic​Responder

A basic, closure-based Responder.

Application.​HTTP.​Client
HTTPCookies

A collection of HTTPCookies.

HTTPCookies.​Value

A single cookie (key/value pair).

HTTPHeaders.​Cache​Control

Represents the HTTP Cache-Control header.

HTTPHeaders.​Cache​Control.​Max​Stale

The max-stale option can be present with no value, or be present with a number of seconds. By using a struct you can check the nullability of the maxStale variable as well as then check the nullability of the seconds to differentiate.

HTTPHeaders.​Expires
HTTPHeaders.​Last​Modified

Represents the HTTP Last-Modified header.

HTTPHeaders.​Connection
HTTPHeaders.​Content​Disposition
HTTPHeaders.​Content​Disposition.​Value
HTTPHeaders.​Range

Represents the HTTP Range request header. See https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Range

HTTPHeaders.​Content​Range

Represents the HTTP Content-Range response header.

HTTPHeaders.​Forwarded

Parses the Forwarded header.

HTTPHeaders.​Name

Type used for the name of a HTTP header in the HTTPHeaders storage.

HTTPMedia​Type

Represents an encoded data-format, used in HTTP, HTML, email, and elsewhere.

HTTPMedia​Type​Preference

Represents a MediaType and its associated preference, q.

Application.​HTTP.​Server
HTTPServer.​Configuration

Engine server config struct.

HTTPServer.​Configuration.​Compression​Configuration

Supported HTTP compression options.

HTTPServer.​Configuration.​Decompression​Configuration

Supported HTTP decompression options.

CORSMiddleware.​Configuration

Configuration used for populating headers in response for CORS requests.

Middlewares

Configures an application's active Middleware. Middleware will be used in the order they are added.

Application.​Password
Application.​Passwords
Application.​Passwords.​Provider
Async​Password​Hasher
Request.​Password
Request.​Body
Application.​Responder
Application.​Responder.​Provider
Response.​Body

Represents a Response's body.

Web​Socket​Max​Frame​Size
HOTP

Create a one-time password using hash-based message authentication codes.

TOTP

Create a one-time password using hash-based message authentication codes and taking uniqueness from the time.

Application.​Servers
Application.​Servers.​Provider
Application.​Sessions
Application.​Sessions.​Provider
Memory​Sessions

Simple in-memory sessions implementation.

Session​ID
Session​Data

A container for storing data associated with a given SessionID.

Sessions​Configuration

Configuration options for sessions.

URLEncoded​Form​Decoder

Decodes instances of Decodable types from application/x-www-form-urlencoded Data.

URLEncoded​Form​Decoder.​Configuration

Used to capture URLForm Coding Configuration used for decoding

URLEncoded​Form​Encoder

Encodes Encodable instances to application/x-www-form-urlencoded data.

URLEncoded​Form​Encoder.​Configuration

Used to capture URLForm Coding Configuration used for encoding.

Any​Response

A type erased response useful for routes that can return more than one type.

Byte​Count

Represents a number of bytes:

Decoder​Unwrapper
Directory​Configuration

DirectoryConfiguration represents a configured working directory. It can also be used to derive a working directory automatically.

Dot​Env​File

Reads dotenv (.env) files and loads them into the current process.

Dot​Env​File.​Line

Represents a KEY=VALUE pair in a dotenv file.

Extend

A wrapper around a simple [String: Any] storage dictionary used to implement Extendable.

File

Represents a single file.

File​IO

FileIO is a convenience wrapper around SwiftNIO's NonBlockingFileIO.

Storage
URI
URI.​Scheme

A URI's scheme.

Validation
Validation​Result
Validations
Validations​Result
Validations​Error
Validator
Validator​Results
Validator​Results.​Nested
Validator​Results.​Nested​Each
Validator​Results.​Skipped
Validator​Results.​Missing
Validator​Results.​Not​Found
Validator​Results.​Codable
Validator​Results.​Invalid
Validator​Results.​Type​Mismatch
Validator​Results.​And

ValidatorResult of "And" Validator that combines two ValidatorResults. If both results are successful the combined result is as well.

Validator​Results.​Case

ValidatorResult of a validator thaat validates whether the data can be represented as a specific Enum case.

Validator​Results.​Character​Set

ValidatorResult of a validator that validates that a String contains characters in a given CharacterSet.

Validator​Results.​Collection​Character​Set

ValidatorResult of a validator that validates that all elements of a [String] contain characters in a given CharacterSet.

Validator​Results.​Email

ValidatorResult of a validator that validates whether a String is a valid email address.

Validator​Results.​Empty

ValidatorResult of a validator that validates whether the data is empty.

Validator​Results.​In

ValidatorResult of a validator that validates whether an item is contained in the supplied sequence.

Validator​Results.​Nil

ValidatorResult of a validator that validates that the data is nil.

Validator​Results.​Nil​Ignoring

ValidatorResult of a validator that ignores nil values.

Validator​Results.​Not
Validator​Results.​Or

ValidatorResult of "Or" Validator that combines two ValidatorResults. If either result is successful the combined result is as well.

Validator​Results.​Range

ValidatorResult of a validator that validates whether the input is within a supplied range.

Validator​Results.​URL

ValidatorResult of a validator that validates whether a string is a valid URL.

Validator​Results.​Valid

ValidatorResult of a validator that validates that the data is valid`.

Application.​Views
Application.​Views.​Provider
Plaintext​Renderer
View

Enumerations

Application.​Event​Loop​Group​Provider
Bcrypt​Error
Serve​Command.​Error

Errors that may be thrown when serving a server

Help​Format

Available formatting options for generating debug info for Debuggable errors.

Body​Stream​Result
Endpoint​Cache​Error
HTTPCookies.​Same​Site​Policy

A cookie which can only be sent in requests originating from the same origin as the target domain.

HTTPHeaders.​Range​Unit

The unit in which ContentRanges and Ranges are specified. This is usually bytes. See https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Range

HTTPHeaders.​Range.​Value

Represents one value of the Range request header.

HTTPHeaders.​Content​Range.​Value

Represents the value of the Content-Range request header.

HTTPVersion​Major
CORSMiddleware.​Allow​Origin​Setting

Option for the allow origin header in responses for CORS requests.

Redirect​Type

Specifies the type of redirect that the client should receive.

HTTPBody​Stream​Strategy

Determines how an incoming HTTP request's body is collected.

OTPDigits

Supported OTP output sizes.

OTPDigest

Supported OTP digests.

Bind​Address
URLEncoded​Form​Decoder.​Configuration.​Date​Decoding​Strategy

Supported date formats

URLEncoded​Form​Encoder.​Configuration.​Array​Encoding

Supported array encodings.

URLEncoded​Form​Encoder.​Configuration.​Date​Encoding​Strategy

Supported date formats

Basic​Coding​Key

A basic CodingKey implementation.

Range​Result

Type used by Range and Count validators to indicate where a value fell within a range.

Validation​Key

Protocols

Lock​Key
Authenticatable

Capable of being authenticated.

Authenticator

Helper for creating authentication middleware.

Request​Authenticator

Help for creating authentication middleware based on Request.

Basic​Authenticator

Helper for creating authentication middleware using the Basic authorization header.

Bearer​Authenticator

Helper for creating authentication middleware using the Bearer authorization header.

Credentials​Authenticator

Helper for creating authentication middleware using request body contents.

Session​Authenticator

Helper for creating authentication middleware in conjunction with SessionsMiddleware.

Session​Authenticatable

Models conforming to this protocol can have their authentication status cached using SessionAuthenticator.

Cache

Codable key-value pair cache.

Client
Content

Convertible to / from content in an HTTP message.

Content​Encoder
Content​Decoder
Content​Container
URLQuery​Decoder
URLQuery​Encoder
URLQuery​Container

Helper for encoding and decoding data from an HTTP request query string.

Abort​Error

Errors conforming to this protocol will always be displayed by Vapor to the end-user (even in production mode where most errors are silenced).

Debuggable​Error

Debuggable provides an interface that allows a type to be more easily debugged in the case of an error.

Body​Stream​Writer
Responder
Middleware

Middleware is placed between the server and your router. It is capable of mutating both incoming requests and outgoing responses. Middleware can choose to pass requests on to the next Middleware in a chain, or they can short circuit and return a custom Response if desired.

Password​Hasher
Response​Encodable

Can convert self to a Response.

Request​Decodable
Route​Collection

Groups collections of routes together for adding to a router.

Routes​Builder
Server
Session​Driver

Capable of managing CRUD operations for Sessions.

Coding​Key​Representable

Capable of being represented by a CodingKey.

Extendable

Types conforming to Extendable can have stored properties added in extension by using the Extend struct.

Lifecycle​Handler
Optional​Type

Capable of being represented by an optional wrapped type.

Any​Optional​Type

Type-erased OptionalType

Storage​Key
Validatable

Capable of being validated. Conformance adds a throwing validate() method.

Validator​Result
View​Renderer

Typealiases

HTTPStatus

Less verbose typealias for HTTPResponseStatus.

Functions

_stdlib_demangle​Impl(mangled​Name:​mangled​Name​Length:​output​Buffer:​output​Buffer​Size:​flags:​)

Here be dragons! _stdlib_demangleImpl is linked into the stdlib. Use at your own risk!

Variables

Bcrypt

Creates and verifies BCrypt hashes.