lucifer
library
Enums
Level
Level s to control logging output. Logging can be enabled to include all
levels above certain Level .
Method
HTTP Methods supported by Lucifer
Functions
contentSecurityPolicy ()
→ Callback
Content Security Policy (CSP) helps prevent unwanted content from being
injected/loaded into your webpages.
cors ({dynamic origin = '*' , String methods = 'GET,HEAD,PUT,PATCH,POST,DELETE' , bool ? credentials , int ? maxAge , bool ? preflightContinue , int ? optionsSuccessStatus })
→ Callback
Middleware to handle CORS.
crossDomain ({String permitted = 'none' })
→ Callback
The X-Permitted-Cross-Domain-Policies header tells some web clients
(like Adobe Flash or Adobe Acrobat) your domain's policy
for loading cross-domain content.
crossOriginEmbedderPolicy ()
→ Callback
This middleware sets the Cross-Origin-Embedder-Policy header.
crossOriginOpenerPolicy ({String policy = 'same-origin' })
→ Callback
This middleware sets the Cross-Origin-Opener-Policy header.
crossOriginResourcePolicy ({String policy = 'same-origin' })
→ Callback
This middleware sets the Cross-Origin-Resource-Policy header.
dnsPrefetchControl ({bool allow = false })
→ Callback
This middleware lets you set the X-DNS-Prefetch-Control to control
browsers' DNS prefetching.
env (String key )
→ dynamic
get environment variable value based on key
expectCT ({int maxAge = 0 , bool enforce = false , String ? reportUri })
→ Callback
The Expect-CT HTTP header tells browsers to expect Certificate Transparency.
getStatusMessage (int statusCode )
→ String
hidePoweredBy ()
→ Callback
Simple middleware to remove the X-Powered-By HTTP header if it's set.
json ()
→ Callback
Middleware to parse json request body.
logger ({Level level = Level.verbose , LogPrinter ? printer })
→ Callback
Middleware to handle logging with package logger
https://pub.dev/packages/logger
multipart ()
→ Callback
Middleware to parse multipart request body.
mustache ([String ? views ])
→ Callback
Middleware to handle templating with Mustache.
noSniffMimetype ()
→ Callback
Some browsers will try to "sniff" mimetypes. For example, if my server
serves file.txt with a text/plain content-type, some browsers can still
run that file with .
originAgentCluster ()
→ Callback
Origin-Agent-Cluster is a new HTTP response header that instructs
the browser to prevent synchronous scripting access between same-site
cross-origin pages.
parseBody (HttpRequest request )
→ Future <RequestBody >
parse raw body of a HttpRequest into RequestBody
data
parseJson (String body )
→ Map <String , dynamic >
Parse json request body into map
parseMultipart (Req req , {void onFieldListener (String name , Object field )?, void onFileListener (String name , UploadedFile file )?, void onErrorListener (dynamic error )?, void onEndListener ()? })
→ Future
Parse multipart request into map body and uploaded files
parseUrlEncoded (String body )
→ Map <String , dynamic >
Parse urlencoded request body into map
parseValue (String value )
→ dynamic
Parse string value into its appropriate type
rateLimiter ()
→ Callback
Middleware to handle rate limiting.
raw ()
→ Callback
Middleware to fill request body with its raw bytes
referrerPolicy ({dynamic policy = 'no-referrer' })
→ Callback
The Referer HTTP header is typically set by web browsers to tell the server
where it's coming from.
secureCookie (String secret )
→ Callback
Middleware to use secure cookies
security ()
→ Callback
Middleware to handle all security.
session ({required String secret })
→ Callback
Middleware to manage sessions.
static (String directory )
→ Callback
Middleware to handle static content.
strictTransportSecurity ({int maxAge = 180 * 24 * 60 * 60 , bool includeSubdomains = true , bool preload = false })
→ Callback
This middleware adds the Strict-Transport-Security header to the response.
This tells browsers, "hey, only use HTTPS for the next period of time".
text ()
→ Callback
Middleware to get request body as string.
urlencoded ()
→ Callback
Middleware to parse urlencoded request body.
xDownloadOptions ()
→ Callback
This middleware sets the X-Download-Options header to noopen to
prevent Internet Explorer users from executing downloads
in your site's context.
xFrameOptions ({String action = 'SAMEORIGIN' })
→ Callback
The X-Frame-Options HTTP header restricts who can put your site in
a frame which can help mitigate things like clickjacking attacks.
xssClean ()
→ Callback
Middleware to handle xss filtering.
xXssProtection ()
→ Callback
X-XSS-Protection is a feature of Internet Explorer and Chrome that stops
pages from loading when they detect reflected
cross-site scripting (XSS) attacks.