mirror of
https://github.com/versia-pub/server.git
synced 2026-03-13 22:09:16 +01:00
Handle routes that dont exist
This commit is contained in:
parent
b7b82fee15
commit
c98f788fec
3 changed files with 46 additions and 11 deletions
21
server/api/[...404].ts
Normal file
21
server/api/[...404].ts
Normal 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);
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue