5

I have kind of a hello world app in Haskell servant, here's a part of it:

type API = 
  "my_items" :> Get '[JSON] [MyItem]
  :<|> "my_items" :> Capture "id" Int :> Get '[JSON] MyItem
  -- ...................

and the urls are:

  localhost/my_items
  localhost/my_items/123

How can I add a prefix to the existing urls and others I'll create:

  localhost/api/v1/my_items
  localhost/api/v1/my_items/123
  localhost/api/v1/.....

?

Alan Coromano
  • 24,958
  • 53
  • 135
  • 205

1 Answers1

8

Just create another type:

type APIv1 = "api" :> "v1" :> API
Sibi
  • 47,472
  • 16
  • 95
  • 163