Take a template directory argument as a
FilePath and create a
Servant type representing the files in the directory. Empty
directories will be ignored.
index.html files will also be
served at the root.
For example, assume the following directory structure:
$ tree dir/
dir/
├── js
│ └── test.js
└── index.html
createApiType is used like the following:
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE TemplateHaskell #-}
type FrontEndAPI = $(createApiType "dir")
At compile time, it will expand to the following:
type FrontEndAPI =
"js" :> "test.js" :> Get '[JS] ByteString
:<|> Get '[HTML] Html
:<|> "index.html" :> Get '[HTML] Html