repositorypackage
1.0.0
Repository: https://github.com/mattinordstrom/moxy.git
Documentation: pkg.go.dev
# Packages
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
# README
moxy
mocking and proxying requests on localhost
Setup:
Install go
Follow instructions here: https://go.dev/doc/install
Add alias
Add to ~/.zshrc:
alias moxy="cd /home/matti/projects/moxy && go run main.go"
Run:
Run (on default port 9097)
$ moxy
Run on another port
$ moxy -p 9098
Admin UI:
Go to http://localhost:9097/moxyadminui
Edit proxies and mocks directly:
Edit mocks: mockdef.json
Edit proxies: proxydef.json
Quick notes:
- Json files will be read for every request (cached 2 sec), so no need to restart moxy after change in json file
- Mocks will always go before proxies.
- Json files are read from top to bottom and request is processed at first match.
- If no match is found in Json the "Default route" will be used
- URLs will be matched "if contains", so the order and precision in the json urlpart is important
- If payload and payloadFromFile are both defined payload will be used
- .* can be used in urlpart in mocks and proxies
- Copy config_template.yml to config.yml to use your own config
_______________________
For developers:
Run tests:
$ go test ./... -v | sed -e 's/PASS/\x1b[32m&\x1b[0m/' -e 's/FAIL/\x1b[31m&\x1b[0m/'
Run lint:
$ golangci-lint run -v
Precommit hook installation:
$ pip3 install pre-commit
$ pre-commit install
Run precommit manually
$ pre-commit run --all-files