Still needs work
This commit is contained in:
parent
14db5f99c5
commit
72844bf6c8
3 changed files with 18 additions and 6 deletions
|
@ -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'] ?? '<unknown>';
|
||||
return await res
|
||||
.render('index', {'title': 'Form Submission', 'message': msg});
|
||||
});
|
||||
|
||||
app.use(() => throw new AngelHttpException.notFound());
|
||||
|
||||
|
|
|
@ -1,5 +1,12 @@
|
|||
<extend src="layout.jl">
|
||||
<block name="content">
|
||||
Hello, world!!!
|
||||
<i if=message != null>
|
||||
You said: {{ message }}
|
||||
</i>
|
||||
<form action="/" method="post">
|
||||
<input name="message" placeholder="Say something..." type="text" value=message>
|
||||
<br>
|
||||
<input type="submit" value="Submit">
|
||||
</form>
|
||||
</block>
|
||||
</extend>
|
|
@ -12,8 +12,5 @@
|
|||
<block name="content">
|
||||
<i>Content goes here.</i>
|
||||
</block>
|
||||
<script>
|
||||
window.alert("a");
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in a new issue