JavaWebStack / JavaWebStack/http-router

Add support for named routes

Open
#20 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Java
Stars
2
Forks
1
PR merge metrics
No merged PRs in 30d

Description

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
```java
@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
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by tracing how routing annotations such as @Get and @PathPrefix are processed, then inspect the server.makeRoute entry point shown in the example. Define how route names, URL generation, and path-parameter validation should work, and verify the named greetUser example produces /api/users/JanHolger.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api, backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.