drengr 0.0.3
drengr: ^0.0.3 copied to clipboard

A sample command-line application.

Drengr #

A Web Framework that gives you a fighting chance. #

Drengr features a command line interface for starting a new Drengr project! Check it out!

Note: As of 0.0.2, Drengr uses a config yml file that is generated by the CLI. If you choose to not use the CLI, you'll need to generate a matching config.yml file.

The best examples for how to use Drengr are captured in the test folder. Eventually, we'll refactor this out into tests and examples separately, but for now, they live together :)

Drengr is (somewhat) composable. If you only want to use the Router, you can only use the router. If you want to use the whole framework, that works too! Of course, there are some things that don't make sense to be used alone (Controllers, for example).

Using the entire framework together (the App) gives you the following (but not limited to) benefits:

  • First class support (this is the way we use Drengr too!)
  • A modular system with light Dependency Injection, Routing, Controllers, and more.
  • Templating via the Mustache template specification.

Here's an example of how you can use Drengr!

import 'package:drengr/app/app.dart';
import 'package:drengr/container/container.dart';
import 'package:drengr/router/router.dart';
import 'package:drengr/router/request.dart';
import 'package:drengr/router/response.dart';
import 'package:drengr/controllers/controller.dart';

// You can pull me out to a separate file, too ya know ;)
class SampleController extends Controller {
  Response show(Request request) {
    return view('main_template');

Future main() async {
  var router = Router();
  // Controller example
  router.get('/', controller: SimpleController(), method:'home');
  // Bare route handler example
  router.get('/hello', handler: (Request request) {
    return Response.Ok('Hello World!');
  // Plucking things out of the container example
  router.get('/config', handler: (Request request) {
    return Response.Ok(request.container.make('@config'));
  // Path Params example
  router.get('/:name', handler: (Request request) {
    return Response.Ok(request.pathParams['name']);
  var container = Container();
  // Add your own DI objects to the container here
  var app = App(router: router, container: container);
  return app.start();
pub points

A sample command-line application.



API reference






flat, mustache_template, path_to_regexp, yaml


Packages that depend on drengr