From 7be184442c31316715019f5bbfa1902558ae2698 Mon Sep 17 00:00:00 2001 From: joseferben Date: Wed, 28 Aug 2024 11:13:57 +0200 Subject: [PATCH] fix: use express static middleware in prod --- web/app/config/middleware.ts | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/web/app/config/middleware.ts b/web/app/config/middleware.ts index c150a35..6380dd3 100644 --- a/web/app/config/middleware.ts +++ b/web/app/config/middleware.ts @@ -1,4 +1,5 @@ import { env } from "app/config/env"; +import express from "express"; import { defineMiddleware, getDatabase, @@ -22,13 +23,8 @@ export default defineMiddleware(async ({ app, config }) => { redirects: config.http.redirects, }), ); - app.use( - config.http.staticPath, - middleware.staticFiles({ - nodeEnv, - dir: config.paths.public, - }), - ); + // TODO use built-in middleware + app.use(config.http.staticPath, express.static(config.paths.public)); app.use(middleware.rateLimit({ nodeEnv })); app.use(middleware.json()); app.use(middleware.urlencoded());