spry_router 0.0.3 copy "spry_router: ^0.0.3" to clipboard
spry_router: ^0.0.3 copied to clipboard

discontinuedreplaced by: spry

A request router for the Spry web framework that supports matching handlers from path expressions.

Spry router #

Spry makes it easy to build web applications and API applications in Dart with middleware composition processors. This package provides Spry with request routing handlers that dispatch requests to handlers by routing matching patterns.

Installation #

Add the following to your pubspec.yaml file:

dependencies:
  spry_router: any

Or install it from the command line:

$ pub install

Example #

import 'dart:io';
import 'package:spry/spry.dart';
import 'package:spry_router/spry_router.dart';

void main() async {
  final Spry spry = Spry();
  final Router router = Router();

  router.all('/', (context) {
    context.response
      ..status(HttpStatus.ok)
      ..send('Hello World!');
  });

  router.get('/hello/:name', (Context context) {
    final String name = context.request.param('name') as String;

    context.response
      ..status(HttpStatus.ok)
      ..send('Hello $name!');
  });

  await spry.listen(router, port: 3000);

  print('Listening on http://localhost:3000');
}
1
likes
0
pub points
2%
popularity

Publisher

verified publisherodroe.com

A request router for the Spry web framework that supports matching handlers from path expressions.

Homepage
Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

http_methods, prexp, spry

More

Packages that depend on spry_router