SPA fallback

SPA fallback means, for a single-page application, returning index.html for any route handled by the client (/profil), so that a reload or a direct link works. The server first serves static files and API routes, but must not return index.html for /api.

Example

app.get('*splat', (req, res) => res.sendFile(path.join(dist, 'index.html')));

Related concepts

The whole glossary