Skip to content

How to shut the server down #132

Closed Answered by jodersky
kwalcock asked this question in Q&A
Discussion options

You must be logged in to vote

TL;DR: if you use cask with object App extend cask.MainRoutes {...} you can't do it

In general, you need to access the Undertow server that underpins cask's HTTP handling and call the stop() method.

As per the Undertow docs

The above example starts a simple server that returns Hello World to all requests. The server will listen on the localhost address on port 8080 until the server.stop() method is called.

Now, how you access the server is dependent on how you use cask.

In case you started cask by extending cask.MainRoutes and calling main() (as is done in the most simple cases e.g. object App extends cask.MainRoutes), then there is no way to stop the server programmatically. This is be…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by kwalcock
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants