refactor: ♻️ Always use explicit types in every function

This commit is contained in:
Jesse Wierzbinski 2024-11-02 00:43:33 +01:00
parent 54cea29ce9
commit c1dcdc78ae
No known key found for this signature in database
62 changed files with 359 additions and 226 deletions

View file

@ -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) {