Crate trillium_api[][src]

Expand description

This crate represents a first pass at a utility crate for creating APIs with trillium.rs.

Formats supported:

Currently, this crate supports receiving application/json and application/x-form-www-urlencoded by default. To disable application/x-form-www-urlencoded support, use default-features = false.

This crate currently only supports sending json responses, but may eventually add Accepts negotiation and further outbound response content types.

The ApiConnExt extension trait and ApiHandler can be used independently or in combination.

ApiHandler provides an easy way to deserialize a single type from the request body, with a default approach to handling invalid serialization. ApiHandler does not handle serializing responses, so is best used in conjunction with ApiConnExt::with_json. If you need custom handling for deserialization errors, use ApiConnExt::deserialize instead of ApiHandler.

Macros

Construct a serde_json::Value from a JSON literal.

Structs

Trillium API handler

Enums

Represents any valid JSON value.

Traits

Extension trait that adds api methods to trillium::Conn

Functions

Convenience function to build a trillium api handler. This is an alias for ApiHandler::new.