dart_router_extended library
Support for doing something awesome.
More dartdocs go here.
Classes
- AbstractRoute
- Cascade
- A helper that calls several handlers in sequence and returns the first acceptable response.
- Controller
- DefaultRouteGuard
- ErrorJson
- HttpRequest
- IOServer
-
A Server backed by a
dart:io
HttpServer. - JsonRequest
- JsonResponse
- Pipeline
- A helper that makes it easy to compose a set of Middleware and a Handler.
- Request
- An HTTP request to be processed by a Shelf application.
- Response
- The response returned by a Handler.
- Route
-
Annotation for handler methods that requests should be routed when using
package
shelf_router_generator
. - RouteBuilder
- RouteGuard
- Router
- A shelf Router routes requests to handlers based on HTTP verb and route pattern.
- Server
- An adapter with a concrete URL.
- ServerHandler
- A connected pair of a Server and a Handler.
- ToJson
Enums
Extensions
- MiddlewareExtensions on Middleware
- Extensions on Middleware to aid in composing Middleware and Handlers.
- RouterParams on Request
Constants
- defaultGuard → const DefaultRouteGuard
Properties
- addChunkedEncoding → Middleware
-
Middleware that adds
chunked transfer coding
to a responses if none of the following conditions are true:
final
Functions
-
createMiddleware(
{FutureOr< Response?> requestHandler(Request)?, FutureOr<Response> responseHandler(Response)?, FutureOr<Response> errorHandler(Object error, StackTrace)?}) → Middleware - Creates a Middleware using the provided functions.
-
handleRequest(
HttpRequest request, Handler handler, {String? poweredByHeader = 'Dart with package:shelf'}) → Future< void> -
Uses
handler
to handlerequest
. -
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.
-
params(
Request request, String name) → String - Get a URL parameter captured by the Router.
-
serve(
Handler handler, Object address, int port, {SecurityContext? securityContext, int? backlog, String? poweredByHeader = 'Dart with package:shelf'}) → Future< HttpServer> -
Starts an HttpServer that listens on the specified
address
andport
and sends requests tohandler
. -
serveRequests(
Stream< HttpRequest> requests, Handler handler, {String? poweredByHeader = 'Dart with package:shelf'}) → void - Serve a Stream of HttpRequests.
Typedefs
Exceptions / Errors
- HijackException
- An exception used to indicate that a request has been hijacked.