34 lines
778 B
Haskell
34 lines
778 B
Haskell
|
module Main (main) where
|
|||
|
|
|||
|
import Core
|
|||
|
import Database
|
|||
|
import Handlers
|
|||
|
|
|||
|
import Control.Monad.Except (ExceptT (ExceptT))
|
|||
|
import Data.List
|
|||
|
import Effectful
|
|||
|
import Effectful.Error.Static (Error, runError, runErrorNoCallStack, throwError)
|
|||
|
import Effectful.FileSystem
|
|||
|
import Network.Wai.Handler.Warp (run)
|
|||
|
import Servant hiding ((:>), throwError)
|
|||
|
import qualified Servant as S
|
|||
|
|
|||
|
main :: IO ()
|
|||
|
main = run port $ serve proxy app
|
|||
|
|
|||
|
app :: Server API
|
|||
|
app = α $ rootHandler
|
|||
|
:<|> userListHandler
|
|||
|
:<|> userGetHandler
|
|||
|
:<|> userPostHandler
|
|||
|
|
|||
|
α :: ServerT API AppEff -> ServerT API Handler
|
|||
|
α = hoistServer proxy $ Handler . ExceptT .
|
|||
|
runEff . runErrorNoCallStack . runFileSystem . runDatabaseIO
|
|||
|
|
|||
|
port :: Int
|
|||
|
port = 8080
|
|||
|
|
|||
|
proxy :: Proxy API
|
|||
|
proxy = Proxy
|