The Endpoints Explorer window only recognizes literal strings for routes. For example, the following declaration shows up in the Endpoints Explorer window:
public static class MyEndpoints {
public static void MapMyEndpoints(this IEndpointRouteBuilder routes) {
var group = routes.MapGroup("api/test");
group.MapGet("/{id}", TestGetMethod);
}}
However, the following is invisible to the Endpoints Explorer window:
public static class MyEndpoints {
private const string ApiBase = "api/Test";
public static void MapMyEndpoints(this IEndpointRouteBuilder routes) {
var group = routes.MapGroup(ApiBase);
group.MapGet($"{ApiBase}/{id}", TestGetMethod);
}}
This can be a significant limitation, since it forces the declaration literal route strings that may be spread across many solution files, and other projects that may consume the API.
Document Details
⚠ Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.
The Endpoints Explorer window only recognizes literal strings for routes. For example, the following declaration shows up in the Endpoints Explorer window:
However, the following is invisible to the Endpoints Explorer window:
This can be a significant limitation, since it forces the declaration literal route strings that may be spread across many solution files, and other projects that may consume the API.
Document Details
⚠ Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.