brianmoran / mockify Goto Github PK
View Code? Open in Web Editor NEWEasy, configurable API mocking you can change on-the-fly
License: MIT License
Easy, configurable API mocking you can change on-the-fly
License: MIT License
@brianmoran
Can you please update the Docker Hub image (https://hub.docker.com/r/brianmoran/mockify/tags) for this project?
Would be nice to be able to remove my fork for this image that have the feature I need :)
Allow for multiple responses. For example, on 1st call to an endpoint provide response[0], the second response[1] etc. and simply starting over at the end of the list to allow for multiple kinds of response (successes and failures).
There is a difference in method checking.
Following 2 mockify treat as different:
"method": "GET" and "method": "get"
Or at least adjust example from main README.md, or add a warning about case sensitivity. It is confusing, it make me to lost one hour.
in the routes config add something like:
{
"routes":[
{
"path":"/helloworld/{key}",
"methods":[
"GET",
"POST"
],
"responsePath":"app/response/helloworld/helloworld.json"
}
],
"objects":[
{
"wines":[
{
"id":1,
"product":"SOMMELIER SELECT",
"desc":"Old vine Cabernet Sauvignon",
"price":159.99
},
{
"id":2,
"product":"MASTER VINTNER",
"desc":"Pinot Noir captures luscious aromas",
"price":89.99
},
{
"id":3,
"product":"WINEMAKER'S RESERVE",
"desc":"Merlot featuring complex flavors of cherry",
"price":84.99
},
{
"id":4,
"product":"ITALIAN SANGIOVESE",
"desc":"Sangiovese grape is famous for its dry, bright cherry character",
"price":147.99
}
],
"comments":[
{
"id":1,
"body":"like the added grape skins",
"wineId":1
},
{
"id":1,
"body":"the directions need to be clearer",
"wineId":2
},
{
"id":3,
"body":"I received 3 different packages of wood chips",
"wineId":1
}
],
"profile":{
"name":"vintnor"
}
}
]
}
Objects would create endpoints for each as:
This give you a full fledged API to start coding frontend apps as well as a powerful capabily to extends and build extra endpoints with the routes
@p4tin made a change to allow response matching. We should update the README to add some examples of what that means.
Hello, thanks for the small cool project!
Any chances we can have also the ARM version of the image in docker hub?
It's necessary with all the people with M1/M2 chip based Macbooks ๐๐ฝ
As far as my experience goes it's much easier than in the past now with docker to build multi-arch with buildx
and push,
or use it through CI, e.g. https://www.docker.com/blog/multi-arch-build-and-images-the-simple-way/.
Let me know if I can help, in case.
Thanks again!
git clone https://github.com/brianmoran/mockify.git
cd mockify/
go get github.com/gorilla/mux
go get github.com/sirupsen/logrus
go get github.com/json-iterator/go
go get gopkg.in/yaml.v2
go build -o main ./app/cmd/mockify.go
export MOCKIFY_PORT=8001
export MOCKIFY_ROUTES=/home/user/go/src/mockify/config/routes.yaml
./main
INFO[0000] Looking for routes.yaml file: /Users/moranb1/repos/brianmoran/mockify/config/routes.yaml
INFO[0000] yamlFile.Get err #open /Users/moranb1/repos/brianmoran/mockify/config/routes.yaml: no such file or directory
INFO[0000] map[]
INFO[0000] Ready on port 8001!
Please support timeout response.
Thanks!
It would be nice for easy debugging to see the request and responses like it is done in https://requestbin.com
Using the port as an environment var it will be easier to spin up multiple containers at once
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.