Skip to content

Commit

Permalink
docs: updated the docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Raymond Ottun committed Dec 4, 2021
1 parent ee5de53 commit c4dbdc0
Show file tree
Hide file tree
Showing 2 changed files with 79 additions and 28 deletions.
33 changes: 32 additions & 1 deletion docs/content/en/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,37 @@ reasons:

Deputy is a simulator for HTTP-based APIs that is useful in software development and comprehensive testing.

<img src="/landing.png" width="1280" height="640" alt=""/>
<img src="landing.png" width="1280" height="640" alt=""/>

## Quick Start

Create a mock file and put it in a folder called `mocks`

```json
[
{
"request": {
"path": "/user/(d+)/slug/(.*)",
"params": {
"output_type": "json|xml"
}
},
"response": {
"status": 200,
"headers": {
"Content-Type": "application/json"
},
"body": [
{
"id": "slug-id",
"content": "The post content"
}
]
}
}
]
```

<code-group>
<code-block label="NPM" active>

Expand All @@ -43,6 +70,10 @@ docker run -p 8080:8080 -p 8081:8081 ghcr.io/sayjava/deputy
</code-block>
</code-group>

```bash
curl -X GET http://localhost:8080/user/20/slug/super-dupa-content
```

## Why Use Deputy

<list :items="reasons"></list>
Expand Down
74 changes: 47 additions & 27 deletions mocks/mocks.json
Original file line number Diff line number Diff line change
@@ -1,28 +1,48 @@
[
{
"name": "Successful todo",
"id": "first_behavior",
"request": {
"path": "/todo/[0-9]+",
"method": "(GET|POST|DELETE|PUT)"
},
"response": {
"body": {
"id": 2,
"text": "The todo body"
}
}
},
{
"name": "Failed todo",
"id": "last_behavior",
"request": {
"path": "/customer",
"method": "(GET|POST|DELETE|PUT)"
},
"response": {
"statusCode": 500,
"body": "Server blew up"
}
}
]
{
"name": "Successful todo",
"id": "first_behavior",
"request": {
"path": "/todo/[0-9]+",
"method": "(GET|POST|DELETE|PUT)"
},
"response": {
"body": {
"id": 2,
"text": "The todo body"
}
}
},
{
"name": "Failed todo",
"id": "last_behavior",
"request": {
"path": "/customer",
"method": "(GET|POST|DELETE|PUT)"
},
"response": {
"statusCode": 500,
"body": "Server blew up"
}
},
{
"request": {
"path": "/user/(\\d+)/slug/(.*)",
"params": {
"output_type": "json|xml"
}
},
"response": {
"status": 200,
"headers": {
"Content-Type": "application/json"
},
"body": [
{
"id": "slug-id",
"content": "The post content"
}
]
}
}
]

0 comments on commit c4dbdc0

Please sign in to comment.