The `create-server` package provides a unified API for establishing HTTP, HTTPS, and SPDY servers in Node.js, aiming to simplify common server setup patterns. It handles the boilerplate for configuring server instances, including providing a callback-based interface for various server events (close, request, upgrade, listening, error, etc.). The library, last updated in April 2019 at version 1.0.2, notably features built-in 'sane defaults' for security against older threats like POODLE and Heartbleed, and allows custom overrides for ciphers and protocols. However, its primary differentiator, SPDY support, is now largely obsolete in favor of HTTP/2 and HTTP/3. Given its age, the package is likely to lack support for modern JavaScript features like native ESM and may contain security defaults that are no longer considered best practice against contemporary threats.
npm install create-serverVerified import paths — ran on the pinned version, not inferred.
Demonstrates creating a basic HTTP server using `create-server` on port 3000, handling incoming requests, and logging server events. Includes graceful shutdown.
Migrate to servers supporting HTTP/2 or HTTP/3, such as Node.js's built-in `http2` module or newer web frameworks, rather than relying on SPDY.
Manually audit and update TLS cipher suites, protocols, and options to align with current best practices for server security (e.g., using TLS 1.3, strong ciphers).
Ensure your project is configured for CommonJS, or use dynamic `import()` if absolutely necessary within an ESM context, understanding the interoperability limitations.
Always provide absolute paths for certificate files or carefully verify the `root` directory and relative paths. Ensure files are readable by the Node.js process.
Change the `port` configuration to an available port number, or terminate the process currently using that port.
Install the `spdy` package: `npm install spdy` or remove the `spdy: true` option if SPDY is not intended.
Verify that the `root` option points to the correct base directory and that all certificate/key file paths (relative or absolute) are accurate. Ensure the Node.js process has read permissions for these files.