mirror of
https://github.com/versia-pub/server.git
synced 2026-03-13 05:49:16 +01:00
refactor(api): ♻️ Remove old redirect() and response() in favour of Hono's builtins
This commit is contained in:
parent
691716f7eb
commit
69d7d50239
20 changed files with 188 additions and 174 deletions
|
|
@ -1,5 +1,4 @@
|
|||
import { apiRoute, applyConfig, handleZodError } from "@/api";
|
||||
import { response } from "@/response";
|
||||
import { zValidator } from "@hono/zod-validator";
|
||||
import { and, eq, inArray, sql } from "drizzle-orm";
|
||||
import { z } from "zod";
|
||||
|
|
@ -83,9 +82,6 @@ export default apiRoute((app) =>
|
|||
403,
|
||||
);
|
||||
}
|
||||
|
||||
const objectString = JSON.stringify(apiObject);
|
||||
|
||||
// If base_url uses https and request uses http, rewrite request to use https
|
||||
// This fixes reverse proxy errors
|
||||
const reqUrl = new URL(context.req.url);
|
||||
|
|
@ -102,10 +98,7 @@ export default apiRoute((app) =>
|
|||
"GET",
|
||||
);
|
||||
|
||||
return response(objectString, 200, {
|
||||
"Content-Type": "application/json",
|
||||
...headers.toJSON(),
|
||||
});
|
||||
return context.json(apiObject, 200, headers.toJSON());
|
||||
},
|
||||
),
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue