servant/servant-examples/getting-started/getting-started.hs

29 lines
576 B
Haskell
Raw Normal View History

2015-05-05 21:50:24 +02:00
import Network.Wai
import Network.Wai.Handler.Warp
import System.Environment
import qualified GS1
import qualified GS2
2015-05-05 22:54:55 +02:00
import qualified GS3
2015-05-06 13:36:04 +02:00
import qualified GS4
2015-05-05 21:50:24 +02:00
app :: String -> Maybe Application
app n = case n of
"1" -> Just GS1.app
"2" -> Just GS2.app
2015-05-05 22:54:55 +02:00
"3" -> Just GS3.app
2015-05-06 13:36:04 +02:00
"4" -> Just GS4.app
2015-05-05 21:50:24 +02:00
_ -> 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."