Skip to content

Hotreload

Ravi Teja Gudapati edited this page Feb 20, 2019 · 1 revision

Hot reload enables quick debugging, experimentation and bug fixing by restarting the application whenever a change is detected in one of the source files. Use jaguar_hotreload package to add hot reload feature to your server application.

main() async {
  final reloader = HotReloader(debounceInterval: const Duration(seconds: 10));
  reloader.addPath('.');
  await reloader.go();

  final server = Jaguar();
  server.get('/hello', (Context ctx) => 'Hello world!');
  await server.serve();
}

Connection to VM service

jaguar_hotreload uses hot reload feature provided by VM services of Dart SDK.

To run your application with VM service enabled use --observe command line flag.

dart --observe bin/server.dart

This will start VM services on port 8181. 8181 is the VM service port HotReloader will listen to by default.

Custom VM service port

Custom VM service port can be configured using vmServiceUrl parameter to HotReload constructor. An application can be configured to serve VM service on a custom port using --enable-vm-service command line argument:

dart --enable-vm-service:64159 bin/server.dart

IDE

If you are using an IDE (like IntelliJ) to execute your application note down what port your IDE start VM service on and the HotReload instance accordingly.

References

Basics

Serialization

Forms

Sessions

Authentication

  • Basic authentication
  • Form authentication
  • JSON authentication
  • Authorization
  • OAuth

Database

Security

Real time

  • Server sent events (SSE)
  • Websockets

Deployment

  • systemd
  • Docker
  • AppEngine

API Documentation

Clone this wiki locally