Mocki is a tool that lets you create Mock REST and GraphQL APIs.
Support for
- Simulated failures
- Simulated delays
- Randomized reponses
- Conditional resposes
- Fake data generation
-
Install Mocki
npm install -g mocki
-
Create a config YAML-file using the structure in
.mocki/config.yml
Hello world example:
name: mocki port: 3000 endpoints: - path: /hello method: get responses: - statusCode: 200 body: message: Hello from Mocki!
-
Start your mock by running
mocki run --path ./path/to/config.yml
-
Test your mock by running
curl http://localhost:3000
{ "message": "Hello World!" }
We recommend using nvm to manage Node versions
npm > 6
node > 12
Documentation is available at Mocki.io
- Create tag from latest commit:
git tag vX.Y.Z
- Push tag:
git push origin vX.Y.Z
- Publish to npm:
npm publish
- Update coverage report:
npm run coverage