I would like a way to have a procedural macro, above my api endpoint handler functions that would specify the route, args, etc. and they would be put into one function in main.rs for the actual warp routes. i also would like it to beable to go to build.rs so i can have a mapped-type for typescript so i can have type checking on arguments to my backend api.
eg:
endpoints.rs
#[endpoint(get, "/admin/login", DB, JSON)]
pub fn admin_login_handler(db:DB, data:frontend::AdminLogin)...
#[endpoint(get, ("/admin/query", u32), DB, JSON)]
pub fn admin_query_handler(q:u32, db:DB, data:frontend::AdminLogin)...
main.rs
fn main() {
let routes = get_routes!(db);
warp::serve(routes)...
}
build.rs
fn main() {
let txt = ts::export::<TYPES(&Default::default());
txt.append(get_route_types!());
save file
}
is this possible?