http_routes 1.0.0+3
http_routes: ^1.0.0+3

Flutter Android iOS

Utility for matching http requests with routes

http_routes #

Utility to match http requests with routes

GitHub stars Twitter Follow

Usage #

import 'dart:io';

import 'package:http_routes/http_routes.dart';

void main() async {
  final server = await HttpServer.bind(InternetAddress.anyIPv4, 3000);

  await for (HttpRequest req in server) {
    final route = req.route();

    if (route == GET('/todos')) print('get all todos');
    if (route == GET('/todos/:id'))
      print('get todo with id ${route.param('id')}');

    if (route == GET('/lists/:listId/:todoId'))
      print(
          'get todo with id ${route.param('todoId')} from list ${route.param('listId')}');
  }
}

License #

MIT

GitHub stars Twitter Follow

1
likes
70
pub points
0%
popularity

Publisher

lesnitsky.dev

Utility for matching http requests with routes

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

flutter

More

Packages that depend on http_routes