angel3_framework library

An easily-extensible web server framework in Dart.

Classes

Angel
A powerful real-time/REST/MVC server class.
AngelEnvironment
Queries the environment's ANGEL_ENV value.
AnonymousService<Id, Data>
An easy helper class to create one-off services without having to create an entire class.
AuditableModel
Represents a generic data model with audit log feature.
ChainedRouter<T>
ConstantSegment
Controller
Supports grouping routes with shared functionality.
CookieValue
Shortcut for declaring a request cookie Parameter.
Driver<Request, Response, Server extends Stream<Request>, RequestContextType extends RequestContext, ResponseContextType extends ResponseContext>
Base driver class for Angel implementations.
Expose
Exposes a Controller or a Controller method to the Internet. Example:
Shortcut for declaring a request header Parameter.
HookedService<Id, Data, T extends Service<Id, Data>>
Wraps another service in a service that broadcasts events on actions.
HookedServiceEvent<Id, Data, T extends Service<Id, Data>>
Fired when a hooked service is invoked.
HookedServiceEventDispatcher<Id, Data, T extends Service<Id, Data>>
Can be listened to, but events may be canceled.
Hooks
Attaches hooks to a HookedService.
HostnameRouter
A utility that allows requests to be handled based on their origin's hostname.
HostnameSyntaxParser
Parses a string into a RegExp that is matched against hostnames.
InjectionRequest
Contains a list of the data required for a DI-enabled method to run.
LockableBytesBuilder
MapService
A basic service that manages an in-memory list of maps.
Middleware
Annotation to map middleware onto a handler.
MiddlewarePipeline<T>
A chain of arbitrary handlers obtained by routing a path.
MiddlewarePipelineIterator<T>
Iterates through a MiddlewarePipeline.
Model
Represents a generic data model with an ID and timestamps.
NoExpose
Specifies to NOT expose a method to the Internet.
OptionalSegment
Parameter
Used to apply special dependency injections or functionality to a function parameter.
ParameterSegment
ParsedParameterSegment
Providers
Indicates how the service was accessed.
Query
Shortcut for declaring a request query Parameter.
RequestContext<RawRequest>
A convenience wrapper around an incoming RawRequest.
ResponseContext<RawResponse>
A convenience wrapper around an outgoing HTTP request.
Routable
A routable server that can handle dynamic requests.
Route<T>
Represents a virtual location within an application.
RouteDefinition
RouteGrammar
Router<T>
An abstraction over complex Route trees. Use this instead of the raw API. :)
RouteResult
The result of matching an individual route.
RouteSegment
RoutingResult<T>
Represents a complex result of navigating to a path.
Service<Id, Data>
A front-facing interface that can present data to and operate on data on behalf of the user.
Session
Shortcut for declaring a request session Parameter.
SlashSegment
SymlinkRoute<T>
Placeholder Route to serve as a symbolic link to a mounted Router.
UploadedFile
Reads information about a binary chunk uploaded to the server.
WildcardSegment

Constants

angelEnv → const AngelEnvironment
A constant instance of AngelEnv.
noExpose → const NoExpose

Functions

chain(Iterable<RequestHandler> handlers) RequestHandler
Sequentially runs a list of handlers of middleware, and returns early if any does not return true. Works well with Router.chain.
flatten<T>(Router<T> router) Router<T>
Optimizes a router by condensing all its routes into one level.
handleContained(Function handler, InjectionRequest injection, [Container? container]) RequestHandler
Handles a request with a DI-enabled handler.
ioc(Function handler, {Iterable<String> optional = const []}) RequestHandler
Shortcut for calling preInject, and then handleContained.
preInject(Function handler, Reflector reflector) InjectionRequest
Predetermines what needs to be injected for a handler to run.
resolveInjection(dynamic requirement, InjectionRequest injection, RequestContext req, ResponseContext res, bool throwOnUnresolved, [Container? container]) Future
suitableForInjection(RequestContext req, ResponseContext res, InjectionRequest injection) bool
Checks if an InjectionRequest can be sufficiently executed within the current request/response context.

Typedefs

AngelConfigurer = FutureOr<void> Function(Angel app)
A function that configures an Angel server.
AngelErrorHandler = dynamic Function(AngelHttpException e, RequestContext req, ResponseContext res)
A function that handles error
HookedServiceEventListener<Id, Data, T extends Service<Id, Data>> = FutureOr Function(HookedServiceEvent<Id, Data, T> event)
Triggered on a hooked service event.
RequestHandler = FutureOr Function(RequestContext req, ResponseContext res)
A function that receives an incoming RequestContext and responds to it.
ViewGenerator = FutureOr<String> Function(String path, [Map<String, dynamic>? data])
A function that asynchronously generates a view from the given path and data.

Exceptions / Errors

AngelHttpException
Exception class that can be serialized to JSON and serialized to clients. Carries HTTP-specific metadata, like statusCode.
RoutingException
Represents an error in route configuration or navigation.