Body parsing middleware for lws (local-web-server) that wraps koa-bodyparser. Version 3.0.1 is the latest stable release, requiring Node >=12.17. It provides body parsing for incoming HTTP requests, supporting JSON, URL-encoded, and multipart form data. Key differentiator: integration with lws middleware stack, providing a simple configuration-based approach compared to raw koa-bodyparser. Releases follow lws versioning cadence, with updates primarily driven by underlying koa-bodyparser changes.
npm install lws-body-parserVerified import paths — ran on the pinned version, not inferred.
Creates an lws server with body-parser middleware. Parses request body and echoes it back. Shows ESM import and basic middleware setup.
Migrate to ESM: use 'import' instead of 'require()'.
Ensure incoming requests have the correct Content-Type header. For custom types, configure koa-bodyparser options via lws-body-parser.
Check official lws-body-parser docs for options; avoid depending on undocumented koa-bodyparser options.
Use import() or switch to ESM: 'import bodyParser from "lws-body-parser"' and set "type": "module" in package.json.
Ensure request has proper Content-Type header (e.g., application/json). Verify body-parser middleware is added before route handlers.