flydart 0.0.1 copy "flydart: ^0.0.1" to clipboard
flydart: ^0.0.1 copied to clipboard

A simple and lightweight Dart web framework, pure native. It provides router, group router, RESTful controller and etc. You can write a Middleware for your app easily. And so on.

example/lib/main.dart

import 'package:flydart/flydart.dart';

void main(args) {
  runApp(MyApp());
}

class MyApp extends App {
  @override
  void init() {
    port = 9099;
    get(RouterPattern.from('/helloworld'), (ctx) {
      ctx.render(JSON(json: 'helloworld'));
    });
    controller(MyController());
    use(MyMiddleware());
    useNotFound();
    useCors();
    useExceptionCatcher();
  }
}

class MyController extends Controller {
  @override
  Handler gets() {
    return (ctx) {
    //  ctx.render(Text('helloworld'));
    };
  }

  @override
  Handler post() {
    return (ctx) {
      ctx.render(Text('text'));
    };
  }
}

class MyMiddleware extends Middleware {
  @override
  Handler handler() {
    return (ctx) => {ctx.render(Text('helloworld'))};
  }

  @override
  Method method() {
    return Method.GET;
  }

  @override
  RouterPattern pattern() {
    return RouterPattern.from('/Mw');
  }

  @override
  MiddlewareType type() {
    return MiddlewareType.handler;
  }
}
0
likes
110
pub points
0%
popularity

Publisher

unverified uploader

A simple and lightweight Dart web framework, pure native. It provides router, group router, RESTful controller and etc. You can write a Middleware for your app easily. And so on.

Repository (GitHub)
View/report issues

Documentation

API reference

License

Apache-2.0 (LICENSE)

Dependencies

logging

More

Packages that depend on flydart