Write a server supporting Server::Starter's protocol in Haskell https://github.com/hiratara/hs-server-starter
|Latest on Hackage:||0.1.0.1|
This package is not currently in any snapshots. If you're interested in using it, we recommend adding it to Stackage Nightly. Doing so will make builds more reliable, and allow stackage.org to host generated Haddocks.
Provides a utility to write server program which can be called via Perl's https://github.com/kazuho/p5-Server-Starter program using Haskell.
This module does not provide a Haskell implementation of
so you need to use the original Perl version or use
a version ported to golang.
listenAll function returns a listened
Network.Socket, please call
accept on it.
import qualified Network.ServerStarter.Socket as Starter import qualified Network.Socket as Socket import qualified Network.Wai as Wai import qualified Network.Wai.Handler.Warp as Warp main :: IO () main = do (socket:_) <- Starter.listenAll Socket.SockAddrInet port _ <- Socket.getSocketName socket let setting = Warp.setPort (fromEnum port) $ Warp.defaultSettings Warp.runSettingsSocket setting socket app app :: Wai.Application app = ...
start_server and access to
$ start_server --port 12345 -- stack exec server-starter-warp-example
Masahiro Honma ()