No-dependency api server in your local machine with 1 file route configuration. Live-reloads the mock server if API config changes.
curl -fsSL https://deno.land/x/install/install.sh | sh
git clone https://github.com/kemalelmizan/mock.git
cd mock
cp api_sample.ts api.ts
echo "function mock() { cd $(pwd) && deno run --allow-env --allow-read --allow-run ./wrapper.ts \$@ || cd -; }" >> ~/.zshrc
source ~/.zshrc
mock
mock -c
Using default api.ts
in project directory
mock
Using custom api.ts
mock -c /path/to/api.ts
Test by curl-ing ping endpoint on another terminal window
curl localhost:8080/ping
- mocking api.ts
- live-reload with wrapper
- open
api.ts
file - use custom
api.ts
file - use custom body matcher with fallback
- use custom header matcher with fallback
- use
deno bundle
anddeno install
instead of appending to .bashrc - documentation