{"library":"lws-mock-response","title":"lws-mock-response","description":"Middleware for adding mock responses to lws (local-web-server). Current stable version is 2.0.0, released under an active maintenance cycle. It enables offline development by simulating API responses when network services are unavailable. Mocks are defined in reusable modules. Key differentiators: tight integration with lws ecosystem, simple class-based mock definitions, and support for various response types (JSON, etc.). Ideal for frontend developers working offline or testing scenarios.","language":"javascript","status":"active","last_verified":"Sat Apr 25","install":{"commands":["npm install lws-mock-response"],"cli":null},"imports":["import lwsMockResponse from 'lws-mock-response'"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"// Save as mocks.js\nexport default class MockRivers {\n  mocks () {\n    return {\n      route: '/rivers',\n      responses: [\n        {\n          response: {\n            type: 'json',\n            body: [\n              { name: 'Volga', drainsInto: 'Caspian Sea' },\n              { name: 'Danube', drainsInto: 'Black Sea' },\n              { name: 'Ural', drainsInto: 'Caspian Sea' },\n              { name: 'Dnieper', drainsInto: 'Black Sea' }\n            ]\n          }\n        }\n      ]\n    }\n  }\n}\n\n// Then run: ws --mocks mocks.js\n// curl http://127.0.0.1:8000/rivers","lang":"javascript","description":"Creates a mock response module for lws and runs it with the --mocks CLI option. Responds with JSON data for /rivers endpoint.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}