2016-09-15 19:53:01 +00:00
|
|
|
library angel_framework.http.angel_base;
|
|
|
|
|
|
|
|
import 'dart:async';
|
2016-09-17 16:12:25 +00:00
|
|
|
import 'package:container/container.dart';
|
2016-09-15 19:53:01 +00:00
|
|
|
import 'routable.dart';
|
|
|
|
|
|
|
|
/// A function that asynchronously generates a view from the given path and data.
|
|
|
|
typedef Future<String> ViewGenerator(String path, [Map data]);
|
|
|
|
|
|
|
|
class AngelBase extends Routable {
|
2016-10-22 20:41:36 +00:00
|
|
|
AngelBase({bool debug: false}):super(debug: debug);
|
|
|
|
|
2016-09-17 16:12:25 +00:00
|
|
|
Container _container = new Container();
|
2016-10-22 20:41:36 +00:00
|
|
|
|
2016-09-17 16:12:25 +00:00
|
|
|
/// A [Container] used to inject dependencies.
|
|
|
|
Container get container => _container;
|
|
|
|
|
2016-09-15 19:53:01 +00:00
|
|
|
/// A function that renders views.
|
|
|
|
///
|
|
|
|
/// Called by [ResponseContext]@`render`.
|
|
|
|
ViewGenerator viewGenerator = (String view,
|
|
|
|
[Map data]) async => "No view engine has been configured yet.";
|
|
|
|
}
|