Skip to content

Commit

Permalink
feat: improve header
Browse files Browse the repository at this point in the history
  • Loading branch information
rin-yato committed Sep 20, 2024
1 parent 0f4a168 commit dd45f3c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
4 changes: 4 additions & 0 deletions apps/api/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import type { AppEnv } from "@/setup/context";
import { TransactionTasker } from "@/task/transaction";
import { registerGlobalErrorHandler } from "./setup/error";
import { registerLogger } from "./setup/logger";
import { registerHeaderMiddleware } from "./setup/header";

const app = new OpenAPIHono<AppEnv>();

Expand All @@ -37,6 +38,9 @@ registerAuthMiddleware(app);
// Register Logger
registerLogger(app);

// Register headers middleware
registerHeaderMiddleware(app);

// Register modules
app.route("/", Modules);

Expand Down
8 changes: 8 additions & 0 deletions apps/api/src/setup/header.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { csrf } from "hono/csrf";
import type { App } from "./context";
import { requestId } from "hono/request-id";
import { secureHeaders } from "hono/secure-headers";

export function registerHeaderMiddleware(app: App) {
app.use(csrf(), requestId(), secureHeaders());
}
2 changes: 1 addition & 1 deletion apps/web/biome.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$schema": "https://biomejs.dev/schemas/1.6.3/schema.json",
"files": {
"ignore": [".next", "public", "./src/route-tree.gen.ts"]
"ignore": ["dist", "public", "./src/route.gen.ts"]
},
"extends": ["../../biome.json"],
"linter": {
Expand Down

0 comments on commit dd45f3c

Please sign in to comment.