Description

Dart Router Extended builds on top of shelf and shelf_router packages by expanding their capabilities.

Features

AbstractRoute

This class allows you to create a route handling one or multiple endpoints and integrates with the Controller class

Controller

The controller allows multiple routes to be mounted under a single prefix. This class is meant to mimick the implementation of classic Controller behavior found in frameworks such as Java's Spring or PHP's Symphony

HttpRequest

This utility class allows simpler usages of JSON requests by reducing the request/response boilerplate code found in Dart http library.

Responses

This utility class allows simpler creation of http responses.

RouteGuard

This class allows an implementation to guard routes depending on internal logic overriden by the programmer.

Getting started

Include Dart Extended Router in your pubspec.yaml

dart_router_extended: ^1.0.1

Usage

class IndexRoute extends AbstractRoute {
  IndexRoute() : super(["/"], Method.get);

  @override
  Function buildHandler() {
    return _respond;
  }

  Response _respond(Request req) {
    return Response.ok("Test");
  }
}

void main() {
  Controller(pathPrefix: "/test", routes: [IndexRoute()]);
}

Libraries

dart_router_extended
Support for doing something awesome.