View generator
This commit is contained in:
parent
d51ab2e2a1
commit
04f1a2558b
3 changed files with 5 additions and 7 deletions
|
@ -18,7 +18,7 @@ class ResponseContext extends Extensible {
|
|||
|
||||
/// Sets the status code to be sent with this response.
|
||||
status(int code) {
|
||||
underlyingResponse.statusCode = code;
|
||||
underlyingResponse.statusCode = code;
|
||||
}
|
||||
|
||||
/// The underlying [HttpResponse] under this instance.
|
||||
|
@ -66,9 +66,7 @@ class ResponseContext extends Extensible {
|
|||
|
||||
/// Renders a view to the response stream, and closes the response.
|
||||
Future render(String view, {Map data}) async {
|
||||
/// TODO: app.viewGenerator
|
||||
var generator = app.viewGenerator(view, data: data);
|
||||
write(await generator);
|
||||
write(await app.viewGenerator(view, data: data));
|
||||
header(HttpHeaders.CONTENT_TYPE, ContentType.HTML.toString());
|
||||
end();
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ typedef AngelConfigurer(Angel app);
|
|||
class Angel extends Routable {
|
||||
ServerGenerator _serverGenerator = (address, port) async => await HttpServer
|
||||
.bind(address, port);
|
||||
var viewGenerator = (String view, {Map data}) => {};
|
||||
var viewGenerator = (String view, {Map data}) => "No view engine has been configured yet.";
|
||||
|
||||
HttpServer httpServer;
|
||||
God god = new God();
|
||||
|
|
|
@ -9,5 +9,5 @@ dependencies:
|
|||
mime: ">=0.9.3 <0.10.0"
|
||||
route: ">= 0.4.6 <0.5.0"
|
||||
dev_dependencies:
|
||||
http: ^0.11.3
|
||||
test: ^0.12.13
|
||||
http: ">= 0.11.3 < 0.12.0"
|
||||
test: ">= 0.12.13 < 0.13.0"
|
Loading…
Reference in a new issue