fix: Move compression middleware to cover all /api and /auth routes

This commit is contained in:
Tom Moor
2025-01-14 19:01:51 -05:00
parent 1aaabf113b
commit 8fec6758b8
2 changed files with 2 additions and 3 deletions

View File

@@ -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;

View File

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