shelf_router 1.1.4 copy "shelf_router: ^1.1.4" to clipboard
shelf_router: ^1.1.4 copied to clipboard

A convenient request router for the shelf web-framework, with support for URL-parameters, nested routers and routers generated from source annotations.

pub package package publisher

Web Request Router for Shelf #

Shelf makes it easy to build web applications in Dart by composing request handlers. This package offers a request router for Shelf, matching request to handlers using route patterns.

Also see the shelf_router_generator package for how to automatically generate a Route using the Route annotation in this package.

Example #

import 'package:shelf_router/shelf_router.dart'; import 'package:shelf/shelf.dart'; import 'package:shelf/shelf_io.dart' as io; var app = Router(); app.get('/hello', (Request request) { return Response.ok('hello-world'); }); app.get('/user/<user>', (Request request, String user) { return Response.ok('hello $user'); }); var server = await io.serve(app, 'localhost', 8080); 

See reference documentation of Router class for more information.

See also #

311
likes
160
points
365k
downloads

Publisher

verified publishertools.dart.dev

Weekly Downloads

A convenient request router for the shelf web-framework, with support for URL-parameters, nested routers and routers generated from source annotations.

Repository (GitHub)
View/report issues
Contributing

Topics

#server #shelf

Documentation

API reference

License

Apache-2.0 (license)

Dependencies

http_methods, meta, shelf

More

Packages that depend on shelf_router