kemalelmizan / mock

no-dependency API server with 1 file configuration; live-reloads on API config changes

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

mock

ci

No-dependency api server in your local machine with 1 file route configuration. Live-reloads the mock server if API config changes.

Prerequisite

Deno 1.6.x

Installation

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

Usage

Opening api.ts

mock -c

Running server

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

Todo

  • 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 and deno install instead of appending to .bashrc
  • documentation

License

MIT

About

no-dependency API server with 1 file configuration; live-reloads on API config changes

License:MIT License


Languages

Language:TypeScript 100.0%