diff --git a/back/loaders/express.ts b/back/loaders/express.ts index 63065a21..2a88d4cb 100644 --- a/back/loaders/express.ts +++ b/back/loaders/express.ts @@ -123,7 +123,11 @@ export default ({ app }: { app: Application }) => { app.use(rewrite('/open/*', '/api/$1')); app.use(config.api.prefix, routes()); - app.get('*', (_, res, next) => { + app.get('*', (req, res, next) => { + // Don't serve index.html for API routes + if (req.path.startsWith('/api/')) { + return next(); + } const indexPath = path.join(frontendPath, 'index.html'); res.sendFile(indexPath, (err) => { if (err) {