Skip to content

Commit

Permalink
Merge pull request #11 from fullpipe/bump-deps
Browse files Browse the repository at this point in the history
Bump deps
  • Loading branch information
fullpipe authored Sep 20, 2021
2 parents 915da57 + b40f47c commit 50ea3f9
Show file tree
Hide file tree
Showing 5 changed files with 582 additions and 16 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
jmock
mocks
vendor
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@

jmock
mocks
vendor
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ Simple and easy to use json/post API mock server

Install binary

```
go get -u github.com/fullpipe/jmock
```sh
go install github.com/fullpipe/jmock@latest
```

## Usage
Expand Down Expand Up @@ -72,14 +72,14 @@ request matching. For example `./mocks/users.json`:

Start jmock server

```bash
```sh
jmock "./mocks/*.json" --port 9090 --watch
```

Thats it your fake api is ready. Check the request

```bash
curl localhost:9091/api/users/1
```sh
curl localhost:9090/api/users/1
```

Output
Expand All @@ -93,13 +93,13 @@ Output

Run mock server

```
```sh
docker run -p 9090:9090 -v ${PWD}/mocks:/mocks fullpipe/jmock
```

Or if you need to watch files

```
```sh
docker run -p 9090:9090 -v ${PWD}/mocks:/mocks fullpipe/jmock /mocks/*.json --port 9090 --watch
```

Expand All @@ -124,7 +124,7 @@ Mock consists of 3 blocks `request`, `response`, `proxy`

You could match request by:

```
```json
"request": {
"method": "POST", // http method
"url": "/api/users/*", // query path
Expand All @@ -149,7 +149,7 @@ You could match request by:

For matched request server returns response:

```
```json
"response": {
"code": 200, // status code
"body": "plain text or html", // response body
Expand All @@ -167,7 +167,7 @@ For matched request server returns response:
If you get one mock working. You could use `proxy` to
bypass matched request to real API.

```
```json
"proxy": "http://realapihost.loc"
```

Expand Down
15 changes: 10 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
module github.com/fullpipe/jmock

go 1.12
go 1.17

require (
github.com/buger/jsonparser v0.0.0-20181115193947-bf1c66bbce23
github.com/fsnotify/fsnotify v1.4.7
github.com/buger/jsonparser v1.1.1
github.com/fsnotify/fsnotify v1.5.1
github.com/gobwas/glob v0.2.3
github.com/spf13/cobra v0.0.5
github.com/spf13/cobra v1.2.1
github.com/spf13/pflag v1.0.5 // indirect
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c
)

require (
github.com/inconshreveable/mousetrap v1.0.0 // indirect
golang.org/x/sys v0.0.0-20210917161153-d61c044b1678 // indirect
)
Loading

0 comments on commit 50ea3f9

Please sign in to comment.