Teifion
Teifion

Reputation: 110969

Getting started with Yesod

I've been having a crack at using Yesod and I'm really struggling! I've read multiple tutorials and large amounts of the Yesod book but I'm still unable to get my head around how it works. Ideally I'm looking for a tutorial such as the one for Pyramid (a python web framework). It takes you through every step and explains everything very well.

Sadly I've not been able to find a similar style of tutorial for Yesod yet. If anybody knows of one I'd be delighted if you could furnish me with a link.

In the meantime I've some a more specific query.

I've created a site using the scaffold as suggested in the tutorials. If I want to add new Handlers, Models and Templates, do I need to add individual files into each of the relevant folders each time or can I organise them into their own sub-folders somehow? When I use Pyramid I'm able to put each module in its own folder.

Upvotes: 3

Views: 709

Answers (1)

Kwarrtz
Kwarrtz

Reputation: 2753

Michael Snoyman has written an excellent book which covers every major aspect of web development with Yesod. For more specific tutorials, try taking a look at FP Complete which has extensive material on Yesod. I found this tutorial in particular to be very useful. (Both of these assume a reasonably advanced knowledge of Haskell itself. If this is something you lack, I strongly recommend reading "Learn You a Haskell for Great Good!")

As for adding handler to the scaffolded site, there is actually a builtin command for just that purpose. Running yesod add-handler will ask you for all of the necessary information for creating a skeleton handler (handler name, path, POST or GET, etc.) and will create/modify all of the necessary files for you. Then you just have to add the logic itself to "Handler/MyHandler.hs".

Upvotes: 3

Related Questions