Yesod Web Framework

repository·master·Indexed 25 days ago

https://github.com/yesodweb/yesod

An advanced, high-performance web framework written in Haskell designed for compile-time safety, security, and high developer productivity. The ecosystem includes yesod-core for routing and handlers, yesod-auth for pluggable authentication (including OAuth, OAuth 2.0, and bcrypt), yesod-persistent for database integration, yesod-static for serving static files, and yesod-test for integration testing with CSS selector assertions. It also provides the yesod devel development server for automatic recompilation and reverse proxying.

Tokens
5.3K
Snippets
13
Records
33
Agent score
83%

What's inside Yesod

  1. Overview of yesod-core

    master

    The yesod-core package is the foundational component of the Yesod Web Framework. It provides the essential building blocks required to develop Yesod applications, including:

    • Dispatching: Routing and handling incoming requests.
    • Handler functions: Logic for processing web requests.
    • Widgets: Components for managing HTML, CSS, and JavaScript in a modular way.
  2. Use basic form inputs in Yesod

    master
    The yesod-form package provides standard form input types for Yesod applications. You can access basic inputs such as text, number, time, checkbox, select, and textarea through the Yesod.Form.Fields module. For detailed guidance on implementing forms, refer to the forms chapter in the Yesod book.
  3. Use yesod-form-multi for dynamic input counts

    master
    Use yesod-form-multi to create forms where the user can specify the number of inputs to submit. This package provides functionality for handling variable numbers of inputs and includes features for enforcing a minimum number of required values. It is intended as an alternative to Yesod.Form.MassInput when more control over the input count is required.
  4. Use yesod-test for pragmatic integration testing

    master

    The yesod-test library provides a way to perform integration and system testing for Haskell web applications using WAI. It simulates browser sessions that track cookies and the last visited page. It is built on top of HSpec and HUnit.

    Key features include:

    • Assertions on HTML content using CSS selectors.
    • Automatic handling of CSRF _token fields and framework-generated form field names.
    • Direct database access via runDB to set up preconditions or verify side effects.
  5. Use yesod-eventsource for Server-Sent Events (SSE)

    master

    The yesod-eventsource package enables Yesod applications to push events from the server to the client using the Server-sent events standard.

    On the client side, you can consume these events using the native JavaScript EventSource object in supported browsers. For older browsers, the package provides out-of-the-box support for Remy's polyfill, though you must explicitly enable support for it in your application configuration.

  6. Use yesod-auth for user authentication

    master
    The yesod-auth package provides a pluggable mechanism for user authentication in Yesod applications. It supports various authentication plugins, including OpenID, BrowserID (Mozilla Persona), and email. You can extend authentication capabilities by using additional packages available on Hackage.
  7. Install and use the yesod package

    master
    The yesod package is a 'battery loaded' collection of various Yesod-related packages. While the core logic resides in yesod-core, the yesod package provides a cohesive bundle for easier development. For the command-line executable, use yesod-bin.