Handle routes that dont exist

This commit is contained in:
Jesse Wierzbinski 2024-03-10 17:29:25 -10:00
parent b7b82fee15
commit c98f788fec
No known key found for this signature in database
3 changed files with 46 additions and 11 deletions

21
server/api/[...404].ts Normal file
View file

@ -0,0 +1,21 @@
import { apiRoute, applyConfig } from "@api";
import { errorResponse } from "@response";
export const meta = applyConfig({
allowedMethods: ["POST", "GET", "PUT", "PATCH", "DELETE"],
auth: {
required: false,
},
ratelimits: {
duration: 60,
max: 100,
},
route: "/[...404]",
});
/**
* Default catch-all route, returns a 404 error.
*/
export default apiRoute(() => {
return errorResponse("This API route does not exist", 404);
});