REserve is a lightweight and versatile HTTP server package, currently at stable version 2.3.5. It specializes in serving static files, acting as a reverse proxy, and aggregating resources from multiple sources. The core functionality relies on declarative, regular expression-based mappings defined in a JSON configuration, offering fine-grained control over request routing and handling. The project demonstrates an active release cadence, with frequent minor updates and bug fixes. Its key differentiators include a minimal footprint with zero runtime dependencies, efficient performance (updated to `punycache`@`1.0.1` in v2.3.0), and the power of embedded regular expressions for highly flexible and dynamic server configurations, making it well-suited for development environments and complex routing scenarios without the overhead of larger frameworks.
npm install reserveVerified import paths — ran on the pinned version, not inferred.
Demonstrates how to embed and start a `reserve` HTTP server in a TypeScript application with basic static file serving, including event handling for ready, error, and graceful shutdown on process signals.
Update your `file` handler mappings to explicitly include `"static": true` if you intend for directory listings or other static file behaviors.
Use online regex testers or Node.js `RegExp` to validate your patterns. Start with simple matches and incrementally increase complexity. Ensure patterns are anchored (e.g., `^/path/(.*)$`) to prevent partial matches.
Upgrade to `reserve@2.3.0` or higher to utilize the `force` option with `serverInstance.close({ force: true })` for more reliable server shutdowns.Change the `port` in your `reserve` configuration to an unused port, or terminate the process currently occupying the port (e.g., using `lsof -i :8080` and `kill <PID>` on Linux/macOS, or Resource Monitor on Windows).
Review your `mappings` array. Ensure your `match` regular expressions correctly capture the intended URLs. Check `file` handler paths for correctness relative to the server's working directory or use absolute paths.
Ensure you are calling `.on()` methods directly on the `serve` function's return value, which is an event emitter (Promise-like with `.on()` methods). Do not `await serve(config)` if you intend to chain `.on()` immediately. If using `async/await`, await after chaining events, or capture the returned instance.
No dependency data recorded yet.