protevus/bin/dev.dart
2019-04-18 12:05:40 -04:00

26 lines
876 B
Dart

import 'dart:io';
import 'package:angel/src/pretty_logging.dart';
import 'package:angel/angel.dart';
import 'package:angel_container/mirrors.dart';
import 'package:angel_framework/angel_framework.dart';
import 'package:angel_hot/angel_hot.dart';
import 'package:logging/logging.dart';
main() async {
// Watch the config/ and web/ directories for changes, and hot-reload the server.
hierarchicalLoggingEnabled = true;
var hot = HotReloader(() async {
var logger = Logger.detached('{{angel}}')..onRecord.listen(prettyLog);
var app = Angel(logger: logger, reflector: MirrorsReflector());
await app.configure(configureServer);
return app;
}, [
Directory('config'),
Directory('lib'),
]);
var server = await hot.startServer('127.0.0.1', 3000);
print(
'{{angel}} server listening at http://${server.address.address}:${server.port}');
}