steward 0.3.0 copy "steward: ^0.3.0" to clipboard
steward: ^0.3.0 copied to clipboard

outdated

Steward is a CLI and Framework for building expressive web servers in Dart.

example/main.dart

import 'package:steward/app/app.dart';
import 'package:steward/controllers/controller.dart';
import 'package:steward/controllers/route_utils.dart';
import 'package:steward/router/router.dart';

class SimpleController extends Controller {
  @Get('/show')
  Response show(Request request) {
    return Response.Ok('Hello from SimpleController@show');
  }
}

Future main() async {
  var router = Router();
  router.get('/hello', (Request request) async {
    return Response.Ok('Hello World!');
  });

  router.get('/config', (Request request) async {
    print(request.container);
    print(request.container.make('@config'));
    return Response.Ok(request.container.make('@config'));
  });

  router.mount(SimpleController);

  router.get('/:name', (Request request) async {
    return Response.Ok(request.pathParams['name']);
  });

  var app = App(router: router);

  return app.start();
}
3
likes
0
pub points
0%
popularity

Publisher

unverified uploader

Steward is a CLI and Framework for building expressive web servers in Dart.

Repository

License

unknown (license)

Dependencies

bosun, flat, mustache_template, path_to_regexp, recase, yaml

More

Packages that depend on steward