{"library":"mocker-api","type":"library","category":null,"description":"mocker-api is a development utility designed for mocking RESTful APIs, facilitating frontend development by enabling work independent of a live backend. It supports flexible integration as middleware with common development servers like Express.js and webpack-dev-server. The current stable version is 4.0.0, which has updated its Node.js requirement to `>=16.0.0`. The library features hot module replacement for mock files, allows quick API configuration via JSON or JavaScript files, and provides simple mock API proxying. It also offers first-class TypeScript type definitions for an enhanced developer experience. Unlike some other mocking solutions, `mocker-api` can be used independently without relying on a full webpack setup, making it versatile for various project types, including Create React App. It helps streamline development workflows by providing predictable API responses during the early stages of a project.","language":"javascript","status":"active","version":"4.0.0","tags":["javascript","express","webpack-dev-server","webpack-api-mocker","webpack","mocker-api","mock","mocker","api","typescript"],"install":[{"cmd":"npm install mocker-api","imports":["import apiMocker from 'mocker-api';","import type { MockerAPIOptions } from 'mocker-api';","// In mocker/index.ts:\ninterface User { id: number; name: string; }\nconst mocks: Record<string, User | User[]> = {\n  'GET /api/users': [{ id: 1, name: 'Alice' }, { id: 2, name: 'Bob' }],\n  'GET /api/user/:id': (req, res) => {\n    const id = parseInt(req.params.id, 10);\n    if (id === 1) return res.json({ id: 1, name: 'Alice' });\n    if (id === 2) return res.json({ id: 2, name: 'Bob' });\n    res.status(404).json({ message: 'User not found' });\n  },\n};\nexport default mocks;"]},{"cmd":"yarn add mocker-api","imports":[]},{"cmd":"pnpm add mocker-api","imports":[]}],"homepage":"https://wangchujiang.com/mocker-api/","github":"https://github.com/jaywcjlove/mocker-api","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/mocker-api","openapi_spec":null,"status_page":null,"smithery":null,"compatibility":{"summary":{"python_range":"18–22","success_rate":0,"avg_install_s":null,"avg_import_s":null,"wheel_type":null},"url":"https://checklist.day/v1/registry/mocker-api/compatibility"},"provenance":{"verified_status":null,"verified_at":null,"last_verified":"Wed Jun 17","next_check":"Tue Jul 21","install_tag":null}}