Skip to content
Snippets Groups Projects
Commit 18d9a4ba authored by Jean-Paul Calderone's avatar Jean-Paul Calderone
Browse files

A runnable server

parent 86e86ac1
No related branches found
No related tags found
1 merge request!2Stripe webhook
......@@ -3,7 +3,5 @@ module Main
) where
import PaymentServer.Main
( run
( main -- re-export
)
main = run
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE TypeOperators #-}
module PaymentServer.Main
( run
( main
) where
run :: IO ()
run =
import Servant
( Proxy(Proxy)
, Server
, Application
, serve
, (:>)
)
import Network.Wai.Handler.Warp
( run
)
import PaymentServer.Persistence
( VoucherDatabase
, memory
)
import PaymentServer.Processors.Stripe
( StripeAPI
, stripeServer
)
type PaymentServerAPI = "v1" :> "stripe" :> StripeAPI
paymentServer :: VoucherDatabase d => d -> Server PaymentServerAPI
paymentServer = stripeServer
paymentServerAPI :: Proxy PaymentServerAPI
paymentServerAPI = Proxy
paymentServerApp :: VoucherDatabase d => d -> Application
paymentServerApp = (serve paymentServerAPI) . paymentServer
main :: IO ()
main = memory >>= return . paymentServerApp >>= run 8081
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment