mirror of
https://github.com/versia-pub/server.git
synced 2026-04-27 20:59:15 +02:00
refactor: ♻️ Always use explicit types in every function
This commit is contained in:
parent
54cea29ce9
commit
c1dcdc78ae
62 changed files with 359 additions and 226 deletions
|
|
@ -1,9 +1,13 @@
|
|||
import type { OpenAPIHono } from "@hono/zod-openapi";
|
||||
import type { Server } from "bun";
|
||||
import type { Config } from "~/packages/config-manager/config.type";
|
||||
import type { HonoEnv } from "~/types/api";
|
||||
import { debugResponse } from "./api.ts";
|
||||
|
||||
export const createServer = (config: Config, app: OpenAPIHono<HonoEnv>) =>
|
||||
export const createServer = (
|
||||
config: Config,
|
||||
app: OpenAPIHono<HonoEnv>,
|
||||
): Server =>
|
||||
Bun.serve({
|
||||
port: config.http.bind_port,
|
||||
reusePort: true,
|
||||
|
|
@ -18,7 +22,7 @@ export const createServer = (config: Config, app: OpenAPIHono<HonoEnv>) =>
|
|||
}
|
||||
: undefined,
|
||||
hostname: config.http.bind || "0.0.0.0", // defaults to "0.0.0.0"
|
||||
async fetch(req, server) {
|
||||
async fetch(req, server): Promise<Response> {
|
||||
const output = await app.fetch(req, { ip: server.requestIP(req) });
|
||||
|
||||
if (config.logging.log_responses) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue