about summary refs log tree commit diff
path: root/src/API.hs
blob: 545aa25be777846c14ec87e26f57eee2685d5367 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE TypeOperators #-}
--------------------------------------------------------------------------------
module API where
--------------------------------------------------------------------------------
import Data.Text
import Servant.API

import qualified Types as T
--------------------------------------------------------------------------------

type API = "user"
           :> ReqBody '[JSON] T.Account
           :> Post '[JSON] (Maybe T.Session)
      :<|> "user"
           :> Capture "name" Text
           :> Get '[JSON] (Maybe T.Account)
      -- Create
      :<|> "trips"
           :> ReqBody '[JSON] T.Trip
           :> Post '[JSON] NoContent
      -- Read
      :<|> "trips"
           :> Get '[JSON] [T.Trip]
      -- Delete
      :<|> "trips"
           :> ReqBody '[JSON] T.TripPK
           :> Delete '[JSON] NoContent