From 72844bf6c8c2dcadcf2566b317e131bde71debf2 Mon Sep 17 00:00:00 2001 From: Tobe O Date: Sun, 1 Oct 2017 01:00:14 -0400 Subject: [PATCH] Still needs work --- angel_jael/example/main.dart | 12 ++++++++++-- angel_jael/example/views/index.jl | 9 ++++++++- angel_jael/example/views/layout.jl | 3 --- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/angel_jael/example/main.dart b/angel_jael/example/main.dart index ff044dd4..69a37c99 100644 --- a/angel_jael/example/main.dart +++ b/angel_jael/example/main.dart @@ -4,14 +4,22 @@ import 'package:file/local.dart'; import 'package:logging/logging.dart'; main() async { - var app = new Angel(); + var app = new Angel()..lazyParseBodies = true; var fileSystem = const LocalFileSystem(); await app.configure( jael(fileSystem.directory('views')), ); - app.get('/', (res) => res.render('index', {'title': 'ESKETTIT'})); + app.get('/', + (res) => res.render('index', {'title': 'Sample App', 'message': null})); + + app.post('/', (RequestContext req, res) async { + var body = await req.lazyBody(); + var msg = body['message'] ?? ''; + return await res + .render('index', {'title': 'Form Submission', 'message': msg}); + }); app.use(() => throw new AngelHttpException.notFound()); diff --git a/angel_jael/example/views/index.jl b/angel_jael/example/views/index.jl index e7212a43..bc1cbda2 100644 --- a/angel_jael/example/views/index.jl +++ b/angel_jael/example/views/index.jl @@ -1,5 +1,12 @@ - Hello, world!!! + + You said: {{ message }} + +
+ +
+ +
\ No newline at end of file diff --git a/angel_jael/example/views/layout.jl b/angel_jael/example/views/layout.jl index 72ae1ecc..8e674460 100644 --- a/angel_jael/example/views/layout.jl +++ b/angel_jael/example/views/layout.jl @@ -12,8 +12,5 @@ Content goes here. - \ No newline at end of file