Servez-lib, currently at version 2.11.0, is a minimalist HTTP/HTTPS server library primarily designed for internal use within the author's related projects, `servez-cli` and the `servez` web application. It provides basic static file serving capabilities with configurable ports and root directories, including support for index files and logging. The library is explicitly not intended for external consumption or extension by third-party developers; its maintainer strongly recommends copying its source code directly into projects rather than establishing a package dependency. While it offers a simple way to create a local development server, its release cadence and API stability are not managed with external users in mind, making it an unsuitable choice for general-purpose library development. It offers core functionalities like serving index files and basic request handling through a straightforward API.
npm install servez-libVerified import paths — ran on the pinned version, not inferred.
This example demonstrates how to initialize and start a basic HTTP server using `servez-lib` to serve static files from a 'public' directory, handling graceful shutdown.
Fork or copy the relevant source code files from `servez-lib` into your project, or choose a different, externally-maintained HTTP server library designed for public consumption and extension.
Do not rely on `servez-lib` for long-term external API stability. Any version update should be treated as potentially introducing breaking changes for third-party usage.
Prefer CommonJS `require()` for maximum compatibility. If using ESM, use `import createServez from 'servez-lib';` and thoroughly test your application, especially for advanced features.
Change the `port` option in your `createServez` configuration to an unused port (e.g., 3000, 8000), or identify and terminate the conflicting process.
Ensure the directory specified by the `root` option exists. Create it if necessary before starting the server, or correct the path if it's misspelled.
Set the `index` option in `createServez` to the name of your desired index file (e.g., `index: 'index.html'`) and verify that this file exists directly within the `root` directory you are serving.
No dependency data recorded yet.