From bc4951deee7f80784eab59b41b2636ab6db9f9a8 Mon Sep 17 00:00:00 2001 From: HF Date: Sun, 4 Sep 2022 03:52:48 +0200 Subject: [PATCH] change routes --- src/routes/index.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/routes/index.js b/src/routes/index.js index d02dac8..4804df3 100644 --- a/src/routes/index.js +++ b/src/routes/index.js @@ -130,9 +130,14 @@ const winEtag = etag( { weak: true }, ); -router.get( - `/:t(${AVAILABLE_POPUPS.map((p) => p.toLowerCase()).join('|')})`, - async (req, res) => { +router.use( + AVAILABLE_POPUPS.map((p) => `/${p.toLowerCase()}`), + (req, res, next) => { + if (req.method !== 'GET') { + next(); + return; + } + res.set({ 'Cache-Control': `private, max-age=${15 * 60}`, // seconds 'Content-Type': 'text/html; charset=utf-8',