srvx is a modern, zero-dependency HTTP server framework built on Web Standards (Request/Response API), enabling consistent deployment and execution across multiple JavaScript runtimes including Node.js, Deno, and Bun. It currently stands at version 0.11.15, with active development primarily focusing on bug fixes and performance enhancements in its frequent patch releases. A key differentiator is its emphasis on Web Standard APIs, providing a unified programming model regardless of the underlying runtime. It also boasts a full-featured Command Line Interface (CLI) that includes a file watcher, error handling, static file serving, and logging, streamlining the development workflow. srvx aims for close-to-native performance, especially in Node.js environments.
npm install srvxVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to programmatically create and run an srvx server that handles basic routing using Web Standard Request and Response objects. It sets up a health check endpoint and a personalized greeting API, listening on a configurable port.
Upgrade your Node.js runtime to version 20.16.0 or newer. Use a version manager like `nvm` to switch or update your Node.js environment.
Exercise caution when upgrading between minor versions. Always review the changelog for potential breaking changes. Consider pinning to exact patch versions (`0.11.15`) or using a lockfile to ensure stability in production environments.
Implement robust error handling around `getReader` and other asynchronous I/O operations within your srvx handlers to gracefully manage potential failures.
Ensure all clients and proxy configurations send valid `Host` headers that conform to HTTP specifications. Debug with detailed logging to identify the source of invalid headers if issues arise.
Change the server's listening port to an available one (e.g., `server.listen(3001)`), or identify and terminate the process that is already using the port.
Update your import statements to use ES module syntax (e.g., `import { createServer } from 'srvx'`). Ensure your project's `package.json` specifies `"type": "module"` or use `.mjs` file extensions for ES Modules.Install the package using your package manager (e.g., `npm install srvx`, `pnpm add srvx`, or `yarn add srvx`). If using TypeScript, ensure `tsconfig.json` is correctly configured to include `node_modules/@types`.
No dependency data recorded yet.