An HTTP server for single-page apps that use the HTML5 history API. Version 1.3.1 is the latest stable release, with no recent updates since 2017. It serves multiple single-page apps from various directories or different hosts on the same domain, supporting both static file serving and proxying. Unlike other SPA servers (e.g., serve, http-server), history-server is designed specifically for apps using pushState, with built-in support for multiple app configurations via config file or directory layout. It is a lightweight CLI tool but can also be used programmatically in Node.js.
npm install history-serverVerified import paths — ran on the pinned version, not inferred.
Shows how to use history-server both via CLI and programmatically to serve a single SPA from a directory.
Wrap a single app in an array: createServer([app]).
Call server.listen(port) instead of passing options.
Always use absolute paths or resolve relative to __dirname.
Use const { createServer } = require('history-server');Ensure index.html exists in the root directory of the app and the path mapping is correct.
Change port via -p flag or server.listen(port) to a different port.
No dependency data recorded yet.