case class
es if you want to inject things into them
./mill -w app.runBackground
Compiling /private/tmp/minimalApplication-0.7.6/build.sc
build.sc:4: object creation impossible. Missing implementation for:
def crossScalaVersion: String // inherited from trait CrossModuleBase
object app extends CrossScalaModule{
^
Compilation Failed
CrossScalaModule
back into a normal ScalaModule
def crossScalaVersion
field, but I think for an example project the non-cross module is simpler and more newbie friendly)
Hello,
I've been trying out cask
and so far loving the simplicity!
However, I have a question regarding how to shut down cask
application correctly. Scenario is this: in the main object (extends cask.Main
) message consumer is created, this consumer runs in the main's thread. It basically polls a queue (java.util.concurrent.BlockingQueue
) and does some work. Now in the router object (extends cask.Routes
) on every request its body is put into this queue. So for example if queue consumer fails and throws an exception, I'd like for the whole application to stop. Not sure if it's a good approach but I've tried executionContext.shutdown
from within object extending cask.Main
but routes are still being served and JVM does not exit. So what's the correct way here?
Undertow
server. So I guess I'll just override cask.Main.main
and create the server directly. Though it would be nice for DefaultHandler
to be exposed publicly without needing to extend cask.Main
because now I only need defaultHandler
from it :).
The script from “http://localhost:8080/static/app.js” was loaded even though its MIME type (“”) is not a valid JavaScript MIME type.
And indeed, when I check the headers content type in the browser it is not set. How can set it in Cask? I tried naivelyscript(
type:= "text/javascript", src := "/static/app.js")
but it didn't make the warning disappear.
initialize()
in a cask Routes object, it will traverse all methods defined in the object and derive routing information for all methods annotated with an "endpoint" annotation (common endpoints are defined in thecask.endpoints
package, for example cask.get
). This information is contained in an RoutesEndpointMetadata
object and will be used by the final http request routing mechanism (essentially the code that instructs the webserver how to map HTTP requests to method calls)