Open the-moisrex opened 1 year ago
Ideas:
struct username_validator {
user_type user;
bool operator()(context& ctx) {
// ...
user = ...;
}
};
struct app {
dynamic_router router;
username_validator username{};
app() {
router.options["username"} = username;
router += router / "users" / var{"username"} / "profile" >> &app::profile;
router += router / "users" / username / "profile" >> &app::profile;
}
response profile (context& ctx) {
auto user = ctx.params["username"];
auto user = ctx.params[username];
}
response profile (username_validator username) {
// ...
}
}
Seems like a really cool thing to make, but they seem like a sh*tty design in PHP.
They also have global constraints which is nice as well.