Expand description
This module contains utility functions for generating HTTP responses that are commonly used in web applications. These functions simplify the process of creating responses with various data types.
§Example:
This example illustrates how to construct a JSON-formatted response using a Rust struct.
use loco_rs::{controller::{Json, format}, Result};
pub struct Health {
pub ok: bool,
}
async fn ping() -> Result<Json<Health>> {
format::json(Health { ok: true })
}