jaguar library

Main library that should be imported to write APIs using Jaguar

Classes

AuthorizationUser
BinaryFileFormField
Binary file field in the multipart/form-data
BinaryFileListFormField
ByteResponse
Response that writes the bytes provided in body to the response.
CastableStringMap
ConnectTo
Context
Per-request context object that encapsulates all the data corresponding to a HTTP request and provides a way to write response. It provides various convenience methods and getters to access HTTP request data:
Controller
Controller defines the interface all Jaguar controllers must implement.
DefaultErrorWriter
ErrorWriter
Error writer interface
ExceptionWithResponse
FileFormField<T>
FormField<T>
Abstract class for fields on multipart/form-data
GroupBuilder
HttpMethod
An annotation to define a route
Idied<T>
Interface to require that Model must contain an Id
Interceptor<Result>
An interceptor based on Dart class.
Jaguar
Creates a Jaguar HTTP server.
JaguarHttpHeaders
Class to hold HTTP headers
JaguarMapCoder
Encrypts the Map using encrypter. Signs the Map using signer. The final result is made HTTP friendly by Base64 URL encoding.
JaguarSessionManager
A stateless cookie based session manager.
MapCoder
Codes, encrypts and signs the give Map.
MimeType
identifies the type of content of a message
MimeTypes
A namespace class to expose mime type specific features
Muxable
PasswordUser
Interface for a user model with a password
PathParams
Class to hold path parameters
QueryParams
Class to hold query parameters
Redirect
Response that redirects to the URI specified by body
Request
Request contains information about HTTP request
Response<ValueType>
HTTP response. A route handler must respond to HTTP requests by producing a Response object.
Route
Helps builds a route handler with its interceptors and exception handlers
SecurityContext
The object containing the certificates to trust when making a secure client connection, and the certificate chain and private key to serve from a secure server.
Session
A per-request object containing session information of the request
SessionIo
Reads and writes session data to Context
SessionIoAuthHeader
Reads and writes session data from authorization header
SessionIoCookie
Reads and writes session data from cookies
SessionIoHeader
Reads and writes session data from cookies
SessionManager
Session manager to parse and write session data
SkipResponse
StreamResponse
Response that writes the stream of bytes provided in body to the response.
StringFormField
String field in the multipart/form-data
StringResponse
Response that writes the bytes provided in body to the response.
TextFileFormField
Text file field in the multipart/form-data
TextFileListFormField
UserEmail
AuthorizationUser that uses email as authenticationId and unique record id as authorizationId
UserFetcher<UserModel extends AuthorizationUser>
Interface to fetch user model by authentication and authorization IDs.
UserUsername
AuthorizationUser that uses username as authenticationId and unique record id as authorizationId
UserUsernameEmail
AuthorizationUser that uses username and email as authenticationId and unique record id as authorizationId
WebSocket
A two-way HTTP communication object for client or server applications.
WebSocketStatus
WebSocket status codes used when closing a WebSocket connection.
WsAnnot
WsRespond
WsStream

Constants

kDefaultCharset → const String
kDefaultMimeType → const String

Functions

cleanupSegments(Iterable<String> segments) Iterable<String>
jsonResponseProcessor(Context context, dynamic result) → void
ResponseProcessor to encode response value to json and also set mimetype to MimeType.json.
pathToSegments(String path) Iterable<String>
Splits given path to composing segments
wsEcho() RouteHandler
wsRespond<T>(WsOnConnect onConnect, {Encoding? encoding}) RouteHandler
wsStream<T>(WsOnConnect onConnect) RouteHandler
Data read from stream is sent to the websocket.

Typedefs

Converter<T, F> = T Function(F d)
ExceptionHandler = FutureOr<void> Function(Context ctx, dynamic exception, StackTrace trace)
A function that shall be called when an exception occurs when processing a route.
MimeTypeDetector = String? Function(File f)
ResponseProcessor = FutureOr<void> Function(Context context, dynamic result)
Function that modifies context
RouteHandler<RespType> = FutureOr<RespType> Function(Context context)
Prototype for Route handler. A route handler is a function that shall be invoked when a HTTP request with matching path is received.
RouteInterceptor = FutureOr<void> Function(Context ctx)
Prototype of route interceptor. A router interceptor is a function that runs before or after the route handler.
WsOnConnect<T> = FutureOr<T> Function(Context ctx, WebSocket ws)
WsResponder = FutureOr Function(dynamic data)
WsResultProcessor = String Function(dynamic response)

Exceptions / Errors

WebSocketException