A Cayla application.
An application is created by provided a container in which controllers are discoved.
Creates an application with a top level container object, the object is scanned for the nested controllers.
object controllers { route("/") shared class Index() { shared actual default Response handle() => Response.ok().body("Hello World"); } } void run() { value application = Application(controllers); application.start(); process.readLine(); }
Creates an application with a package container object, the package is scanned for the nested controllers.
void run() { value application = Application(`package my.application`); application.start(); process.readLine(); }
The start method starts the application and returns a Runtime Promise which:
This Promise can be used to be aware of the application life cycle:
Promise<Runtime> runtime = application.start(); runtime.always((Runtime|Exception arg) => print(arg is Runtime then "started" else "failed: ``arg.string``"));
Initializer |
Application(Package|Object container) |
Attributes | |
descriptor | shared ApplicationDescriptor descriptor The application descriptor |
Inherited Attributes |
Attributes inherited from: Object hash, string |