heavy-duty / znap

Performance-first Rust Framework to build APIs compatible with the Solana Actions Spec.
Apache License 2.0
60 stars 1 forks source link

Customizable route paths #45

Closed danmt closed 1 month ago

danmt commented 2 months ago

The route path of actions with params, by default, appends the params at the end of the base_path i.e /buy_product/:product_id. This behavior works for the majority of cases, but there should be an alternative to declare the path manually, in such cases, the Params type should be automatically generated.

#[derive(Action)]
#[path("/stores/:store_id/products/:product_id")]
struct BuyProductAction;

Should automatically generate BuyProductParams, associate it with the BuyProductAction and attach it to the Context.

struct BuyProductParams {
  store_id: String,
  product_id: String,
}