Closed omefire closed 5 years ago
If your existing API's API type is called ExistingAPI
, with handlers named existingServer :: Server ExistingAPI
, then you can do:
type NewAPI = ExistingAPI :<|> "files" :> Raw
newServer :: Server NewAPI
newServer = existingServer :<|> serveDirectoryWebApp "./www"
More file serving functions available at: https://hackage.haskell.org/package/servant-server-0.16/docs/Servant-Server-StaticFiles.html
Thanks a lot! this was helpful. @alpmestan
Feel free to close when your problem is solved, or to come back with other questions if you can't get what you want to work.
I have created a web service that exposes some REST API, but now I want to add another one to serve static files. However, I don't know how to get started.
Here is the code I want to extend: https://github.com/omefire/trello-reminders-server/blob/master/app/Main.hs