servant/servant-examples/getting-started/getting-started.hs
2015-05-09 18:11:03 +02:00

24 lines
490 B
Haskell

import Network.Wai
import Network.Wai.Handler.Warp
import System.Environment
import qualified GS1
import qualified GS2
app :: String -> Maybe Application
app n = case n of
"1" -> Just GS1.app
"2" -> Just GS2.app
_ -> Nothing
main :: IO ()
main = do
args <- getArgs
case args of
[n] -> maybe usage (run 8081) (app n)
_ -> usage
usage :: IO ()
usage = do
putStrLn "Usage:\t getting-started N"
putStrLn "\t\twhere N is the number of the example you want to run."