This is a working example of what I interpreted from the above suggestions.
In a file called SomethingRegistration.cs:
namespace Something.Apis
{
public static class SomethingRegistrationExtension
{
public static IApplicationBuilder UseSomethingRegistration( this IApplicationBuilder builder )
{
return builder.UseEndpoints(endpoints =>
{
endpoints.MapPost("/authenticate", async context => await context.Response.WriteAsync("Reject Something") );
endpoints.MapGet("/confuse/{id}", async context => await context.Response.WriteAsync("Good-Bye World!!!!") );
});
}
}
}
I called it from Program.cs as follows:
...
app.UseRouting();
app.UseSomethingRegistration(); // <-- My routes in another file/folder
app.MapGet( "/", () => "Hello World!" );
app.Run();
Thanks everyone!