Update to use hot reload
This commit is contained in:
parent
58e3c02187
commit
6123740eb5
4 changed files with 17 additions and 2 deletions
|
@ -17,7 +17,7 @@
|
||||||
</content>
|
</content>
|
||||||
<orderEntry type="inheritedJdk" />
|
<orderEntry type="inheritedJdk" />
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
<orderEntry type="library" name="Dart Packages" level="project" />
|
|
||||||
<orderEntry type="library" name="Dart SDK" level="project" />
|
<orderEntry type="library" name="Dart SDK" level="project" />
|
||||||
|
<orderEntry type="library" name="Dart Packages" level="project" />
|
||||||
</component>
|
</component>
|
||||||
</module>
|
</module>
|
|
@ -1,5 +1,6 @@
|
||||||
<component name="ProjectRunConfigurationManager">
|
<component name="ProjectRunConfigurationManager">
|
||||||
<configuration default="false" name="Start Server" type="DartCommandLineRunConfigurationType" factoryName="Dart Command Line Application" singleton="true">
|
<configuration default="false" name="Start Server" type="DartCommandLineRunConfigurationType" factoryName="Dart Command Line Application" singleton="true">
|
||||||
|
<option name="VMOptions" value="--enable-vm-service" />
|
||||||
<option name="filePath" value="$PROJECT_DIR$/bin/server.dart" />
|
<option name="filePath" value="$PROJECT_DIR$/bin/server.dart" />
|
||||||
<method />
|
<method />
|
||||||
</configuration>
|
</configuration>
|
||||||
|
|
|
@ -2,6 +2,7 @@ import 'dart:io';
|
||||||
import 'dart:isolate';
|
import 'dart:isolate';
|
||||||
import 'package:angel/angel.dart';
|
import 'package:angel/angel.dart';
|
||||||
import 'package:angel_diagnostics/angel_diagnostics.dart';
|
import 'package:angel_diagnostics/angel_diagnostics.dart';
|
||||||
|
import 'package:angel_hot/angel_hot.dart';
|
||||||
import 'package:intl/intl.dart';
|
import 'package:intl/intl.dart';
|
||||||
|
|
||||||
startServer(args, {bool clustered: false, SendPort sendPort}) {
|
startServer(args, {bool clustered: false, SendPort sendPort}) {
|
||||||
|
@ -21,7 +22,19 @@ startServer(args, {bool clustered: false, SendPort sendPort}) {
|
||||||
}
|
}
|
||||||
|
|
||||||
await app.configure(logRequests(logFile));
|
await app.configure(logRequests(logFile));
|
||||||
var server = await app.startServer(host, port);
|
HttpServer server;
|
||||||
|
|
||||||
|
// Use `package:angel_hot` in any case, EXCEPT if starting in production mode.
|
||||||
|
if (Platform.environment['ANGEL_ENV'] == 'production')
|
||||||
|
server = await app.startServer(host, port);
|
||||||
|
else {
|
||||||
|
var hot = new HotReloader(createServer, [
|
||||||
|
new Directory('bin'),
|
||||||
|
new Directory('config'),
|
||||||
|
new Directory('lib')
|
||||||
|
]);
|
||||||
|
server = await hot.startServer(host, port);
|
||||||
|
}
|
||||||
|
|
||||||
if (sendPort == null) {
|
if (sendPort == null) {
|
||||||
print('Listening at http://${server.address.address}:${server.port}');
|
print('Listening at http://${server.address.address}:${server.port}');
|
||||||
|
|
|
@ -7,6 +7,7 @@ homepage: https://github.com/angel-dart/angel
|
||||||
dependencies:
|
dependencies:
|
||||||
angel_common: ^1.0.0
|
angel_common: ^1.0.0
|
||||||
angel_configuration: ^1.0.0
|
angel_configuration: ^1.0.0
|
||||||
|
angel_hot: ^1.0.0-rc.1
|
||||||
angel_multiserver: ^1.0.0
|
angel_multiserver: ^1.0.0
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
grinder: ^0.8.0
|
grinder: ^0.8.0
|
||||||
|
|
Loading…
Reference in a new issue