init
This commit is contained in:
33
src/Main.hs
Normal file
33
src/Main.hs
Normal file
@@ -0,0 +1,33 @@
|
||||
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
|
||||
Reference in New Issue
Block a user