Skip to content

Commit

Permalink
fix: Move compression middleware to cover all /api and /auth routes
Browse files Browse the repository at this point in the history
  • Loading branch information
tommoor committed Jan 15, 2025
1 parent 1aaabf1 commit 8fec675
Showing 2 changed files with 2 additions and 3 deletions.
3 changes: 0 additions & 3 deletions server/routes/index.ts
Original file line number Diff line number Diff line change
@@ -2,7 +2,6 @@ import crypto from "crypto";
import path from "path";
import { formatRFC7231 } from "date-fns";
import Koa, { BaseContext } from "koa";
import compress from "koa-compress";
import Router from "koa-router";
import send from "koa-send";
import userAgent, { UserAgentContext } from "koa-useragent";
@@ -92,8 +91,6 @@ if (env.isProduction) {
});
}

router.use(compress());

router.get("/locales/:lng.json", async (ctx) => {
const { lng } = ctx.params;

2 changes: 2 additions & 0 deletions server/services/web.ts
Original file line number Diff line number Diff line change
@@ -2,6 +2,7 @@
import crypto from "crypto";
import { Server } from "https";
import Koa from "koa";
import compress from "koa-compress";
import {
contentSecurityPolicy,
dnsPrefetchControl,
@@ -72,6 +73,7 @@ export default function init(app: Koa = new Koa(), server?: Server) {
app.proxy = true;
}

app.use(compress());
app.use(mount("/auth", auth));
app.use(mount("/api", api));

0 comments on commit 8fec675

Please sign in to comment.