Creates a mock server from a Blueprint API file with the posibility to dynamically bind Javascript function to API routes for dynamic content.
git clone https://github.com/nicupavel/blueprint-dynamic-mock.git
cd blueprint-dynamic-mock
npm install
- Add or download your Apiary/Blueprint API file (usually with .apib or .md extension)
- Edit config.json and set the path to the above API file
- Start mock server:
npm run start
- Test:
curl -X GET http://127.0.0.1:19090/api/4/machine/time
- Edit user/aliases.json and create any aliases for api routes if needed
- Edit user/responses.json and add any dynamic responses that you need for API calls. If none defined the static response from API file is returned. See responses.json for an example.
This project is used in RainMachine Web UI Demo to mock the entire RainMachine API. rainmachine branch has the entire example that is used live. To run RainMachine example:
git checkout origin/rainmachine -b rainmachine
git submodule update --init --recursive
npm run start