Attribute Macro resource

Source
#[resource]
Expand description

Defines a resource handler with URI pattern matching.

§Examples

#[resource(
    uri_template = "file:///{path}",
    mime_type = "text/plain"
)]
async fn read_file(&self, path: String) -> Result<String, Error> {
    std::fs::read_to_string(path).map_err(|e| e.into())
}