Skip to content

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

License

Notifications You must be signed in to change notification settings

kemalelmizan/mock

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

Topics

Resources

License

Stars

Watchers

Forks