Lws is a lean, modular web server designed for rapid full-stack development, serving as an application core for quickly launching local HTTP, HTTPS, and HTTP2 servers. Its behavior is entirely customizable through a plugin system built on Koa middleware, allowing users to load only the specific functionalities required for their projects. Key differentiators include its small footprint, 100% personalizable nature, support for custom views for activity visualization, and both programmatic and command-line interfaces. The current stable version is 4.2.0. The project maintains an active release cadence, with recent updates focusing on Node.js compatibility and refining its modular plugin architecture.
npm install lwsVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to programmatically initialize and start an Lws server, including how to define and register simple inline Koa-style middleware to handle requests and serve custom responses for specific paths.
Migrate your project to use ECMAScript Modules (ESM) syntax (`import ... from 'lws';`) or ensure your Node.js environment is configured for ESM.
Upgrade your Node.js environment to v14 or higher if using Lws versions 4.0.0 through 4.0.x. For versions 4.1.0 and above, Node.js v12.20+ is supported.
Ensure your Node.js version is at least v12.20. If you are specifically targeting the 4.0.x branch, you will still need Node.js v14+.
Always use the full plugin name including the `lws-` prefix when specifying plugins via the `--stack` option (e.g., `--stack lws-static lws-index`).
Install necessary `lws-*` plugins (e.g., `npm install lws-static lws-log`) and include them in your server's stack, either via CLI (`lws --stack lws-static`) or programmatically.
Change your import statement from `const Lws = require('lws');` to `import Lws from 'lws';`. Ensure your project's `package.json` has `"type": "module"` or your file uses the `.mjs` extension.Install the missing plugin using npm (e.g., `npm install --save-dev lws-static`) or yarn (`yarn add --dev lws-static`).
Upgrade your Node.js environment to version 12.20 or newer. Consider using a Node.js version manager like `nvm` to easily switch between versions.
Correct the import statement to `import Lws from 'lws';` to correctly access the default exported class.
No dependency data recorded yet.