feat: Convert helpers to use JS files

This commit is contained in:
Faruk AYDIN
2024-01-04 19:55:41 +01:00
parent 8819ddefa7
commit 85141812d9
48 changed files with 259 additions and 384 deletions

View File

@@ -0,0 +1,20 @@
import express from 'express';
const appAssetsHandler = async (app) => {
app.use('/apps/:appKey/assets/favicon.svg', (req, res, next) => {
const { appKey } = req.params;
const svgPath = `${__dirname}/../apps/${appKey}/assets/favicon.svg`;
const staticFileHandlerOptions = {
/**
* Disabling fallthrough is important to respond with HTTP 404.
* Otherwise, web app might be served.
*/
fallthrough: false,
};
const staticFileHandler = express.static(svgPath, staticFileHandlerOptions);
return staticFileHandler(req, res, next);
});
};
export default appAssetsHandler;