import Servant
import Server

-- API for values of type 'a'
-- indexed by values of type 'i'
type APIFor a i =
  Get '[JSON] [Entity a] -- list 'a's
    :<|> ReqBody '[JSON] a :> Post '[JSON] (Maybe i) -- add an 'a'
    :<|> Capture "id" i
      :> ( Get '[JSON] (Entity a) -- view an 'a' given its "identifier" of type 'i'
             :<|> ReqBody '[JSON] a :> PutNoContent '[JSON] NoContent -- update an 'a'
             :<|> DeleteNoContent '[JSON] NoContent -- delete an 'a'
         )

serverFor ::