bbaldino
07/09/2020, 5:46 PMclass MyClass {
val module: Application.() -> Unit {
...
}
}
and then it's installed/started via something like:
val myClass = MyClass()
embeddedServer(Jetty) {
myClass.module(this)
}
which isn't bad, but wondering if there's a better/more idiomatic way?nschulzke
07/09/2020, 6:42 PMobject
instead without any worry about shared state. Then you can do this:
embeddedServer(Jetty, module=MyClass.module)
bbaldino
07/09/2020, 6:44 PMnschulzke
07/09/2020, 6:49 PMembeddedServer(Jetty, module=MyClass().module)
bbaldino
07/09/2020, 6:50 PMnschulzke
07/09/2020, 6:54 PMclass MyTest
, in the Application itself, or in global variables? If your class only has that single function (the application module), then presumably all state is contained in the receiving Application object, which is fine.bbaldino
07/09/2020, 6:57 PMnschulzke
07/09/2020, 7:02 PMbbaldino
07/09/2020, 7:12 PM