dartvel_backend library

Classes

Body
CorsOptions
CORS options.
DVBackendCron
Annotation for a Backend Cron Job
DVBackendFunction
Annotation for a Dartvel Backend Function
DVIpAddress
An IPv4 or IPv6 address.
DVPeerAddress
The address and, when known, the port at the other end of a connection.
DVRouteBodyLimit
A route as the native server needs to know it: its method, its pattern, and the largest body it reads.
Headers
Request
Res
Response
Router
Routes a request to the first route whose method and pattern match it.
ServerHandle
Server handle for builds where the native FFI server is not linked.
TlsConfig
TLS configuration.
URLPattern

Constants

dvDefaultSecurityHeaders → const Map<String, String>
The headers every response gets when it has not set the same name itself.
dvDefaultStrictTransportSecurity → const String
HSTS for a response served over TLS: one year, no includeSubDomains, since a framework cannot know what else runs under the same domain.

Functions

dvApplySecurityHeaders(Headers headers, {Map<String, String> baseline = dvDefaultSecurityHeaders, bool overTls = false}) → void
Adds baseline to headers, keeping any header the handler already set, and HSTS when overTls is true.
embedNativeServerLibrary(List<int> bytes) → void
Gives this process the native server library as bytes. Nothing to load where there is no FFI, so this only records that the call was made.
embedNativeServerLibraryAt(String path, {required int offset, required int length}) → void
Where there is no FFI there is no library to embed.
serve(Future<Response> handler(Request), {String host = '127.0.0.1', int port = 8080, TlsConfig? tls, bool h2c = false, CorsOptions? cors, String? staticDir, String? spaRoot, bool compression = true, Duration requestTimeout = const Duration(seconds: 60), int maxBodyBytes = 1024 * 1024, Iterable<DVRouteBodyLimit> routeBodyLimits = const <DVRouteBodyLimit>[], Map<String, String> securityHeaders = dvDefaultSecurityHeaders}) → Future<ServerHandle>
Serves the handler configuration.