2017-10-19 21:53:33 +00:00
|
|
|
import 'dart:io';
|
2021-06-14 00:08:25 +00:00
|
|
|
import 'package:angel/angel.dart';
|
2021-09-25 10:45:23 +00:00
|
|
|
import 'package:belatuk_pretty_logging/belatuk_pretty_logging.dart';
|
2021-06-11 04:00:10 +00:00
|
|
|
import 'package:angel3_container/mirrors.dart';
|
|
|
|
import 'package:angel3_framework/angel3_framework.dart';
|
|
|
|
import 'package:angel3_hot/angel3_hot.dart';
|
2018-12-31 01:40:24 +00:00
|
|
|
import 'package:logging/logging.dart';
|
2017-10-19 21:53:33 +00:00
|
|
|
|
2021-02-19 14:34:24 +00:00
|
|
|
void main() async {
|
2017-10-19 21:53:33 +00:00
|
|
|
// Watch the config/ and web/ directories for changes, and hot-reload the server.
|
2019-04-18 16:05:40 +00:00
|
|
|
hierarchicalLoggingEnabled = true;
|
|
|
|
|
|
|
|
var hot = HotReloader(() async {
|
2022-03-15 05:25:51 +00:00
|
|
|
var logger = Logger.detached('[Angel3]')
|
2019-05-01 23:32:55 +00:00
|
|
|
..level = Level.ALL
|
|
|
|
..onRecord.listen(prettyLog);
|
2019-04-18 16:05:40 +00:00
|
|
|
var app = Angel(logger: logger, reflector: MirrorsReflector());
|
2017-10-19 21:53:33 +00:00
|
|
|
await app.configure(configureServer);
|
2018-12-31 01:40:24 +00:00
|
|
|
return app;
|
2017-10-19 21:53:33 +00:00
|
|
|
}, [
|
2019-04-18 16:05:40 +00:00
|
|
|
Directory('config'),
|
|
|
|
Directory('lib'),
|
2017-10-19 21:53:33 +00:00
|
|
|
]);
|
|
|
|
|
|
|
|
var server = await hot.startServer('127.0.0.1', 3000);
|
2019-04-18 16:05:40 +00:00
|
|
|
print(
|
2022-03-15 05:25:51 +00:00
|
|
|
'[angel] server listening at http://${server.address.address}:${server.port}');
|
2017-10-19 21:53:33 +00:00
|
|
|
}
|