[Haskell-cafe] Lifetime control of webserver

☂Josh Chia (謝任中) joshchia at gmail.com
Fri Jul 13 01:50:26 UTC 2018


Hi,

My application is not a webserver but needs to run a webserver for part but
not all of its lifetime. Particularly, there's a part that does some
complex computation and I want a webserver to expose its internal
state/progress through HTTP.

It seems that the typical and expected way to use a webserver is to
designate the entire app itself as a webserver, so that functions like the
following are basically infinite loops that serve HTTP:

Web.Scotty.scotty:
http://hackage.haskell.org/package/scotty-0.11.2/docs/Web-Scotty.html#v:scotty

Network.Wai.Handler.Warp.run:
http://hackage.haskell.org/package/warp-3.2.22/docs/Network-Wai-Handler-Warp.html#v:run

Can I run a webserver with explicit control of its lifetime? Particularly,
I want to be able to kill it without killing the app or explicitly serve
one request at a time. I'm not restricted to scotty or warp.

Josh
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20180713/412b919f/attachment.html>


More information about the Haskell-Cafe mailing list