roux 1.0.1 copy "roux: ^1.0.1" to clipboard
roux: ^1.0.1 copied to clipboard

A Lightweight, fast router for Dart with expressive pathname syntax.

example/main.dart

import 'package:roux/roux.dart';

void main() {
  final router = Router<String>();
  router.add('/', 'root');
  router.add('/users/all', 'usersAll');
  router.add('/users/:id', 'userDetail');
  router.add('/users/*', 'usersWildcard');
  router.add('/**', 'globalFallback');

  describe(router, '/');
  describe(router, '/users/all');
  describe(router, '/users/42');
  describe(router, '/users/42/profile');
  describe(router, '/unknown/path');
}

void describe(Router<String> router, String path) {
  final match = router.find(path);
  if (match == null) {
    print('$path -> no match');
    return;
  }
  print('$path -> ${match.data} params=${match.params}');
}
4
likes
160
points
781
downloads

Documentation

API reference

Publisher

verified publishermedz.dev

Weekly Downloads

A Lightweight, fast router for Dart with expressive pathname syntax.

Repository (GitHub)
View/report issues

Topics

#router #http #path-matching #trie

Funding

Consider supporting this project:

github.com

License

MIT (license)

More

Packages that depend on roux