{"library":"express-history-api-fallback","type":"library","category":null,"description":"express-history-api-fallback is an Express middleware designed to facilitate client-side routing for Single Page Applications (SPAs) that utilize the HTML5 History API. It addresses the common problem of 404 errors when a user directly navigates to a client-side route (e.g., `/app/dashboard`) that doesn't correspond to a static file on the server. The middleware ensures that the main `index.html` (or a specified entry point) is served instead. Currently stable at version 2.2.1, with its last known update around May 2017, the package maintains a highly focused approach. It explicitly serves the fallback only for GET/HEAD requests, for requests likely to be HTML, and only if no other static file or route matches. It leverages Express's `res.sendFile()` for efficient serving. While functional and widely used, its release cadence is dormant, indicating it's a mature, feature-complete library rather than one under active development.","language":"javascript","status":"maintenance","version":"2.2.1","tags":["javascript","express","html5","history api","fallback","spa","middleware","connect","pushstate"],"last_verified":"Wed May 27","install":[{"cmd":"npm install express-history-api-fallback","imports":["import fallback from 'express-history-api-fallback'","const fallback = require('express-history-api-fallback')","app.use(fallback('index.html', { root }))"]},{"cmd":"yarn add express-history-api-fallback","imports":[]},{"cmd":"pnpm add express-history-api-fallback","imports":[]}],"homepage":"https://gitlab.com/sebdeckers/express-history-api-fallback#readme","github":null,"docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/express-history-api-fallback","openapi_spec":null,"status_page":null,"smithery":null,"compatibility":{"summary":{"python_range":"18–22","success_rate":0,"avg_install_s":null,"avg_import_s":null,"wheel_type":null},"url":"https://checklist.day/v1/registry/express-history-api-fallback/compatibility"}}