Add explicit MIME type headers for JS and CSS files
This commit is contained in:
1 parent
29c1bd3b83
commit
61f29b2431
1 file changed
+10
@@ -14,6 +14,16 @@ const PORT = process.env.PORT || 3001;
|
|||||||
app.use(cors());
|
app.use(cors());
|
||||||
app.use(express.json());
|
app.use(express.json());
|
||||||
|
|
||||||
|
// Set correct MIME types for static files
|
||||||
|
app.use((req, res, next) => {
|
||||||
|
if (req.url.endsWith('.js')) {
|
||||||
|
res.setHeader('Content-Type', 'application/javascript');
|
||||||
|
} else if (req.url.endsWith('.css')) {
|
||||||
|
res.setHeader('Content-Type', 'text/css');
|
||||||
|
}
|
||||||
|
next();
|
||||||
|
});
|
||||||
|
|
||||||
// API Routes
|
// API Routes
|
||||||
|
|
||||||
// Get all groups
|
// Get all groups
|
||||||
|
|||||||
Reference in new issue
Block a user