platform/bin/dev.dart

23 lines
747 B
Dart
Raw Normal View History

2017-10-19 21:53:33 +00:00
import 'dart:io';
import 'package:angel/angel.dart';
import 'package:angel_framework/angel_framework.dart';
import 'package:angel_hot/angel_hot.dart';
2018-12-11 03:30:48 +00:00
import 'package:lumberjack/lumberjack.dart';
import 'package:lumberjack/io.dart';
2017-10-19 21:53:33 +00:00
main() async {
// Watch the config/ and web/ directories for changes, and hot-reload the server.
2018-12-11 03:30:48 +00:00
var hot = HotReloader(() async {
var app = Angel();
2017-10-19 21:53:33 +00:00
await app.configure(configureServer);
2018-12-11 03:30:48 +00:00
app.logger = Logger('angel')..pipe(AnsiLogPrinter.toStdout());
app.shutdownHooks.add((_) => app.logger.close());
2017-10-19 21:53:33 +00:00
}, [
2018-12-11 03:30:48 +00:00
Directory('config'),
Directory('lib'),
2017-10-19 21:53:33 +00:00
]);
var server = await hot.startServer('127.0.0.1', 3000);
print('Listening at http://${server.address.address}:${server.port}');
}