aboutsummaryrefslogtreecommitdiff
path: root/server/src/Thermoprint/Server.hs
diff options
context:
space:
mode:
authorGregor Kleen <gkleen@yggdrasil.li>2016-01-20 10:22:51 +0000
committerGregor Kleen <gkleen@yggdrasil.li>2016-01-20 10:22:51 +0000
commit1b598d96cafa99da25609125da71d31fbab361bb (patch)
treedc4a21512830e264f8e8c635c79c73f7c8076bc5 /server/src/Thermoprint/Server.hs
parente13e08c31a2816a15ab10c078fd3adeb7abb83d7 (diff)
downloadthermoprint-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/Thermoprint/Server.hs')
-rw-r--r--server/src/Thermoprint/Server.hs22
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
1module Thermoprint.Server 3module Thermoprint.Server
2 ( thermoprintServer 4 ( thermoprintServer
3 , module Data.Default 5 , module Data.Default.Class
4 ) where 6 ) where
5 7
6import Data.Default 8import Data.Default.Class
7import qualified Config.Dyre as Dyre 9import qualified Config.Dyre as Dyre
8 10
9import System.IO (hPutStrLn, stderr) 11import System.IO (hPutStrLn, stderr)
@@ -11,11 +13,20 @@ import System.Exit (exitFailure)
11 13
12import Control.Monad ((<=<)) 14import Control.Monad ((<=<))
13 15
14data Config = Config { dyreError :: Maybe String 16import qualified Network.Wai.Handler.Warp as Warp
17import Network.Wai (Application)
18
19import Servant.Server
20
21import Thermoprint.API
22
23data Config = Config { dyreError :: Maybe String
24 , warpSettings :: Warp.Settings
15 } 25 }
16 26
17instance Default Config where 27instance Default Config where
18 def = Config { dyreError = Nothing 28 def = Config { dyreError = Nothing
29 , warpSettings = Warp.defaultSettings
19 } 30 }
20 31
21thermoprintServer :: Config -> IO () 32thermoprintServer :: Config -> IO ()
@@ -35,4 +46,7 @@ handleDyreErrors cfg
35 46
36 47
37realMain :: Config -> IO () 48realMain :: Config -> IO ()
38realMain _ = undefined 49realMain cfg@(Config{..}) = Warp.runSettings warpSettings $ serve thermoprintAPI thermoprintServer'
50
51thermoprintServer :: Server ThermoprintAPI
52thermoprintServer = undefined