flight 0.0.4 copy "flight: ^0.0.4" to clipboard
flight: ^0.0.4 copied to clipboard

A modern, lightweight, extensible framework for creating rich APIs in Dart.

example/example.dart

import 'package:flight/flight.dart';

void main() {
  Flight f = Flight(
    onBound: (port, addr) => print('Listening on ${addr}:${port}'),
  );

  f(GET, '/test', (req, res) {
    res.send('test');
  });

  f(POST, '/test', (req, res) {
    res.send(req.body);
  });

  f(PUT, '/test', (req, res) {});

  f.group('/group', [
    f(GET, '/child-1', (req, res) {
      res.send('child 1');
    }),
    f(GET, '/child-2', (req, res) {
      res.send('child 2');
    })
  ]);
}
0
likes
40
pub points
30%
popularity

Publisher

unverified uploader

A modern, lightweight, extensible framework for creating rich APIs in Dart.

Repository (GitHub)
View/report issues

License

MIT (LICENSE)

Dependencies

body_parser, http_parser

More

Packages that depend on flight