feat(api): redirect root to API docs, return 410 gone for v1 routes
This commit is contained in:
parent
1b5a90f612
commit
97d8863481
@ -133,7 +133,15 @@ public class Startup
|
||||
app.UseRouting();
|
||||
app.UseAuthentication();
|
||||
app.UseAuthorization();
|
||||
app.UseEndpoints(endpoints => endpoints.MapControllers());
|
||||
app.UseEndpoints(endpoints =>
|
||||
{
|
||||
// register base / legacy routes
|
||||
endpoints.MapMethods("", new string[] { }, (context) => { context.Response.Redirect("https://pluralkit.me/api"); return Task.CompletedTask;});
|
||||
endpoints.MapMethods("v1/{*_}", new string[] { }, (context) => context.Response.WriteJSON(410, "{\"message\":\"Unsupported API version\",\"code\":0}"));
|
||||
|
||||
// register controllers
|
||||
endpoints.MapControllers();
|
||||
});
|
||||
|
||||
// metrics
|
||||
app.UseMetricsAllMiddleware();
|
||||
|
Loading…
Reference in New Issue
Block a user