platform/lib/src/config/routes.dart

20 lines
627 B
Dart
Raw Normal View History

2016-04-22 02:56:21 +00:00
/// This app's route configuration.
library angel.routes;
import 'package:angel_framework/angel_framework.dart';
import 'package:angel_static/angel_static.dart';
/// Put your app routes here!
configureRoutes(Angel app) {
app.get('/', (req, ResponseContext res) => res.render('hello'));
app.get('*', serveStatic());
app.on404 = (RequestContext req, ResponseContext res) async {
res.willCloseItself = true;
res.status(404);
res.header('Content-Type', 'text/html');
res.underlyingResponse.write(
await app.viewGenerator('404', {'path': req.path}));
await res.underlyingResponse.close();
};
}