diff options
Diffstat (limited to 'server/src/Thermoprint')
| -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 | ||
