mirror of
https://github.com/versia-pub/server.git
synced 2026-03-13 22:09:16 +01:00
refactor: ♻️ Use a typed wrapper for all API endpoints
This commit is contained in:
parent
af931b8ade
commit
1a8e063f87
97 changed files with 479 additions and 382 deletions
|
|
@ -1,6 +1,5 @@
|
|||
import { applyConfig, handleZodError } from "@/api";
|
||||
import { apiRoute, applyConfig, handleZodError } from "@/api";
|
||||
import { errorResponse, response } from "@/response";
|
||||
import type { Hono } from "@hono/hono";
|
||||
import { zValidator } from "@hono/zod-validator";
|
||||
import { z } from "zod";
|
||||
|
||||
|
|
@ -26,7 +25,7 @@ export const schemas = {
|
|||
}),
|
||||
};
|
||||
|
||||
export default (app: Hono) =>
|
||||
export default apiRoute((app) =>
|
||||
app.on(
|
||||
meta.allowedMethods,
|
||||
meta.route,
|
||||
|
|
@ -61,4 +60,5 @@ export default (app: Hono) =>
|
|||
"Content-Range": `bytes ${start}-${end}/${file.size}`,
|
||||
});
|
||||
},
|
||||
);
|
||||
),
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue