Skip to content

Add support for named routes #20

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
x7airworker opened this issue Feb 20, 2023 · 0 comments
Open

Add support for named routes #20

x7airworker opened this issue Feb 20, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@x7airworker
Copy link
Member

Add a name parameter to routing annotations such as @Get etc.
This would allow us generate absolute or relative URLs by name and change URLs with less impact on other parts of an application. In addition this could also be used to pre-validate path parameters and create even safer applications.

Examples

@PathPrefix("/api/users")
public class UserController {
    @Get("/{String:name}", name="greetUser")
    public String greet(@Path("name") String name) {
        return "Hello " + name;
   }
}

// In other parts of the application
server.makeRoute("greetUser", "JanHolger"); -> /api/users/JanHolger
@x7airworker x7airworker added the enhancement New feature or request label Feb 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant