Gritshield Route Macros
A set of convenient procedural macros for defining HTTP routes in Gritshield.
Overview
This crate provides attribute macros (#[get], #[post], #[put], etc.) that automatically register routes using the gritshield::routing::trie system.
Installation
Add this to your Cargo.toml:
[]
= { = "../gritshield" }
Supported Macros
| Macro | HTTP Method | Supports Role |
|---|---|---|
#[get] |
GET | Yes |
#[post] |
POST | Yes |
#[put] |
PUT | Yes |
#[patch] |
PATCH | Yes |
#[delete] |
DELETE | Yes |
Syntax Options
// Simple path
// With role protection
How It Works
- Each macro generates a wrapper function that converts your handler into a
BoxFuture. - Automatically registers the route using
inventory::submit!. - Supports optional role-based authorization.
Requirements
- Your handler must accept
gritshield::routing::trie::RequestContext - Your handler should return a type that implements
IntoResponse