diff options
| author | Gregor Kleen <gkleen@yggdrasil.li> | 2016-01-20 10:22:51 +0000 | 
|---|---|---|
| committer | Gregor Kleen <gkleen@yggdrasil.li> | 2016-01-20 10:22:51 +0000 | 
| commit | 1b598d96cafa99da25609125da71d31fbab361bb (patch) | |
| tree | dc4a21512830e264f8e8c635c79c73f7c8076bc5 /server/src | |
| parent | e13e08c31a2816a15ab10c078fd3adeb7abb83d7 (diff) | |
| download | thermoprint-1b598d96cafa99da25609125da71d31fbab361bb.tar thermoprint-1b598d96cafa99da25609125da71d31fbab361bb.tar.gz thermoprint-1b598d96cafa99da25609125da71d31fbab361bb.tar.bz2 thermoprint-1b598d96cafa99da25609125da71d31fbab361bb.tar.xz thermoprint-1b598d96cafa99da25609125da71d31fbab361bb.zip | |
Extended server skeleton up to servant-server
Diffstat (limited to 'server/src')
| -rw-r--r-- | server/src/Thermoprint/Server.hs | 22 | 
1 files changed, 18 insertions, 4 deletions
| diff --git a/server/src/Thermoprint/Server.hs b/server/src/Thermoprint/Server.hs index bba067d..9b8d719 100644 --- a/server/src/Thermoprint/Server.hs +++ b/server/src/Thermoprint/Server.hs | |||
| @@ -1,9 +1,11 @@ | |||
| 1 | {-# LANGUAGE RecordWildCards #-} | ||
| 2 | |||
| 1 | module Thermoprint.Server | 3 | module Thermoprint.Server | 
| 2 | ( thermoprintServer | 4 | ( thermoprintServer | 
| 3 | , module Data.Default | 5 | , module Data.Default.Class | 
| 4 | ) where | 6 | ) where | 
| 5 | 7 | ||
| 6 | import Data.Default | 8 | import Data.Default.Class | 
| 7 | import qualified Config.Dyre as Dyre | 9 | import qualified Config.Dyre as Dyre | 
| 8 | 10 | ||
| 9 | import System.IO (hPutStrLn, stderr) | 11 | import System.IO (hPutStrLn, stderr) | 
| @@ -11,11 +13,20 @@ import System.Exit (exitFailure) | |||
| 11 | 13 | ||
| 12 | import Control.Monad ((<=<)) | 14 | import Control.Monad ((<=<)) | 
| 13 | 15 | ||
| 14 | data Config = Config { dyreError :: Maybe String | 16 | import qualified Network.Wai.Handler.Warp as Warp | 
| 17 | import Network.Wai (Application) | ||
| 18 | |||
| 19 | import Servant.Server | ||
| 20 | |||
| 21 | import Thermoprint.API | ||
| 22 | |||
| 23 | data Config = Config { dyreError :: Maybe String | ||
| 24 | , warpSettings :: Warp.Settings | ||
| 15 | } | 25 | } | 
| 16 | 26 | ||
| 17 | instance Default Config where | 27 | instance Default Config where | 
| 18 | def = Config { dyreError = Nothing | 28 | def = Config { dyreError = Nothing | 
| 29 | , warpSettings = Warp.defaultSettings | ||
| 19 | } | 30 | } | 
| 20 | 31 | ||
| 21 | thermoprintServer :: Config -> IO () | 32 | thermoprintServer :: Config -> IO () | 
| @@ -35,4 +46,7 @@ handleDyreErrors cfg | |||
| 35 | 46 | ||
| 36 | 47 | ||
| 37 | realMain :: Config -> IO () | 48 | realMain :: Config -> IO () | 
| 38 | realMain _ = undefined | 49 | realMain cfg@(Config{..}) = Warp.runSettings warpSettings $ serve thermoprintAPI thermoprintServer' | 
| 50 | |||
| 51 | thermoprintServer :: Server ThermoprintAPI | ||
| 52 | thermoprintServer = undefined | ||
