ds_shelf
library
Functions
-
configureApi(Router router)
→ void
-
-
-
createFileHandler(String path, {String? url, String? contentType})
→ Handler
-
Creates a shelf Handler that serves the file at
path
.
-
createMiddleware({FutureOr<Response?> requestHandler(Request)?, FutureOr<Response> responseHandler(Response)?, FutureOr<Response> errorHandler(Object error, StackTrace)?})
→ Middleware
-
Creates a Middleware using the provided functions.
-
createStaticHandler(String fileSystemPath, {bool serveFilesOutsidePath = false, String? defaultDocument, bool listDirectories = false, bool useHeaderBytesForContentType = false, MimeTypeResolver? contentTypeResolver})
→ Handler
-
Creates a Shelf Handler that serves files from the provided
fileSystemPath
.
-
errorResponse(String message, {int statusCode = 400})
→ Response
-
-
-
joinPaths(String base, String path)
→ String
-
-
jsonResponse(Map<String, dynamic> body, {int statusCode = 200})
→ Response
-
-
logRequests({void logger(String message, bool isError)?})
→ Middleware
-
Middleware which prints the time of the request, the elapsed time for the
inner handlers, the response's status code and the request URI.
-
packagesDirHandler({Map<String, Uri>? packageMap})
→ Handler
-
A handler that serves virtual
packages/
directories wherever they're
requested.
-
packagesHandler({Map<String, Uri>? packageMap})
→ Handler
-
A handler that serves the contents of a virtual packages directory.
-
params(Request request, String name)
→ String
-
Get a URL parameter captured by the Router.
-
parseJson(String jsonStr)
→ Map<String, dynamic>
-
-
parseQueryParams(Request request)
→ Map<String, dynamic>
-
-
proxyHandler(Object url, {Client? client, String? proxyName})
→ Handler
-
A handler that proxies requests to
url
.
-
sanitizeForSQL(String input)
→ String
-
-
saveUploadedFile(Request request, String targetPath)
→ Future<File>
-
-
toJson(Map<String, dynamic> jsonObject)
→ String
-
Exceptions / Errors
-
HijackException
-
An exception used to indicate that a request has been hijacked.