platform/example/main.dart

17 lines
562 B
Dart
Raw Normal View History

2018-09-04 20:04:53 +00:00
import 'dart:async';
import 'dart:isolate';
import 'package:angel_framework/angel_framework.dart';
import 'package:angel_production/angel_production.dart';
2018-09-04 20:13:22 +00:00
main(List<String> args) => new Runner('example', configureServer).run(args);
2018-09-04 20:04:53 +00:00
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...';
});
}