The Yesod Cookbook contains small snippets of code for solving practical problems with Yesod. If you have some code to share, please create a wiki page and link to it in the appropriate section.
If you're looking for a comprehensive guide to learning Yesod, please consider reading the book.
For non-Yesod code, see also Snippets.
- Adding CSS and JS
- JSON Object Create and Append
- Doing AJAX calls with CSRF Protection
- Develop JS without recompiling the yesod project
- RAW JSON Parsing example
- Tip to use statics files
- Change the order of form fields
- Require input for Maybe field
- Custom form layout
- Maintaining Applicative Form Behavior In Monadic Forms
- Password confirm field
- Multi-field validation
- Select field populated from database
- Multi-select field populated from database
- Multi-select field populated from database (esqueleto) - this is the optimized version
- File upload
- File upload saving files to server
- Run raw MongoDB
- Run raw SQL
- Sample MongoDB connection with persistent
- Sphinx Search
- Non scaffolded MongoDB App
- Using Database.Persist.runPool without Foundation
- Using runDB in IO with SQL
- Database Views and Non-Migrated Entities
- Lens for existing site
- Connecting to an additional existing database
- Example MySQL Connection code
- Example Postgres Connection code
- Activate foreign key checking in Sqlite
- Adding Seed data to Scaffolded Site
- Handling exception in persistence
- Builtin Postgresql types with Persistent
- Modelling Schema with Persistent
- Custom data types column in Persistent
- Use HashDB in a scaffolded site
- Abstracting user roles & permissions
- Demo of Yesod.Auth.Email module using JSON endpoints
- Hierarchical routes and breadcrumbs
- Domain-based routing
- Static file subsite Hello World
- Pure-Haskell static subdomains
- Slugs
- Using type-safe URLs from inside Javascript
- Subsite with typeclass contexts and type variables
- TODO: Testing Yesod App
- Performing Authentication during Testing
- Flushing Database Between Tests