Vanitas
Vanitas

Reputation: 903

Can't configure Yesod correctly for API

I'm wishing to build an API using Haskell and Yesod.

However I'm facing some problems.

I've used stack to set up a new Haskell project with the yesod-sqlite template, went ahead and deleted the default Handlers, also removed anywhere they're mentioned in both Application.hs and my cabal file, but, unforunately they are also mentioned in Foundation.hs in a lot of places. for some reason the handlers are very embedded into Yesod, which I find strange.

I don't need any static content or any templates or anything that results in HTML. I just want to return JSON, so I'm wondering if there's a way to ditch Foundation.hs safely, as it looks like it's responsible for the templating, or atleast a way to safely remove Handlers and disable the forced templating.

Upvotes: 0

Views: 51

Answers (1)

jacksjy
jacksjy

Reputation: 36

If you don't need any Session feature or must use Yesod. warp & wai-route & persistent can be a choice. Later you can easy go back to Yesod, once you get the idea, the mechanism behind is close. If you must use Yesod, erase the instance declaration you don't want in the Foundation.hs

Upvotes: 1

Related Questions