platform/example/main.dart
2018-09-04 16:04:53 -04:00

19 lines
595 B
Dart

import 'dart:async';
import 'dart:isolate';
import 'package:angel_framework/angel_framework.dart';
import 'package:angel_production/angel_production.dart';
main(List<String> args) {
var runner = new Runner('example', configureServer);
return runner.run(args);
}
Future configureServer(Angel app) async {
app.get('/', (req, res) => 'Hello, production world!');
app.get('/crash', (req, res) {
// We'll crash this instance deliberately, but the Runner will auto-respawn for us.
new Timer(const Duration(seconds: 3), Isolate.current.kill);
return 'Crashing in 3s...';
});
}