2017-10-19 21:53:33 +00:00
|
|
|
import 'dart:io';
|
2017-10-20 06:22:34 +00:00
|
|
|
import 'package:angel/src/pretty_logging.dart';
|
2017-10-19 21:53:33 +00:00
|
|
|
import 'package:angel/angel.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.
|
|
|
|
var hot = new HotReloader(() async {
|
2018-09-05 00:57:39 +00:00
|
|
|
var app = new Angel();
|
2017-10-19 21:53:33 +00:00
|
|
|
await app.configure(configureServer);
|
2018-07-11 13:42:51 +00:00
|
|
|
hierarchicalLoggingEnabled = true;
|
2018-03-29 23:55:28 +00:00
|
|
|
app.logger = new Logger('angel');
|
|
|
|
var sub = app.logger.onRecord.listen(prettyLog);
|
|
|
|
app.shutdownHooks.add((_) => sub.cancel());
|
2017-10-19 21:53:33 +00:00
|
|
|
return app;
|
|
|
|
}, [
|
|
|
|
new Directory('config'),
|
|
|
|
new Directory('lib'),
|
|
|
|
]);
|
|
|
|
|
|
|
|
var server = await hot.startServer('127.0.0.1', 3000);
|
|
|
|
print('Listening at http://${server.address.address}:${server.port}');
|
|
|
|
}
|