Skip to content

Commit

Permalink
docs: fixed image paths in docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Raymond Ottun committed Dec 5, 2021
1 parent 603e1d7 commit 781caeb
Show file tree
Hide file tree
Showing 5 changed files with 70 additions and 36 deletions.
60 changes: 47 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,45 @@ Deputy is an HTTP API mocking server that can aid in rapid application developme

Deputy can also act as a testing server to validate what requests made by system under test.

![Dev](./docs/static/landing.png)

Here is a sample mock definition

```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"
}
]
}
}
]
```

## Quick Start

With nodejs

```shell
npx @sayjava/deputy
```

With docker

```shell
docker run -p 8080:8080 -p 8081:8081 ghcr.io/sayjava/deputy
```
Expand All @@ -54,36 +85,39 @@ curl http://localhost:8080/who-am-i

## Examples

- [with-nextjs-commerce](examples/with-nextjs-commerce)
- [with-nextjs-middleware](examples/with-nextjs-commerce)
- [with-nextjs-commerce](examples/with-nextjs-commerce)
- [with-nextjs-middleware](examples/with-nextjs-commerce)

## Programitcally

```javascript
const express = require('express')
const { createExpressMiddleware } = require('@sayjava/deputy')
const express = require('express');
const { createExpressMiddleware } = require('@sayjava/deputy');

// mount the mock on a middleware endpoint
const app = express()
app.use('/api', createExpressMiddleware({ mocksFolder: 'fixtures' }))
app.listen(3000, () => console.log('server started'))
const app = express();
app.use('/api', createExpressMiddleware({ mocksFolder: 'fixtures' }));
app.listen(3000, () => console.log('server started'));
```

## Usage Scenarios

Here are some setup scenarios that deputy can be used to aid development and testing

### Transparently Mock & Forward API requests

Simulate unready APIs by mocking some APIs and have other requests transparently forwarded to remote APIs
See the examples/commerce folder using that uses the [next/commerce](next/commerces) + deputy

![Dev](./docs/media/dev_environment.png)
![Dev](./docs/static/dev_environment.png)

### Application Testing

Simulate complex HTTP requests and response scenarios in test environments

![Test](./docs/media/test_environment.png)
![Test](./docs/static/test_environment.png)

see the [Mock Guide](http://sayjava.github.com/deputy)
see the [Mock Guide](http://sayjava.github.io/deputy/mocking)

## Deputy UI

Expand All @@ -93,19 +127,19 @@ By default, Deputy server can be reached at `http://localhost:8081`.

View and inspect http requests and responses from the Logs interface in realtime as requests are received

![Logs](./docs/media/logs.png)
![Logs](./docs/static/logs.png)

### Visualize

Deputy automatically creates a sequence diagram of requests it receives

![Visualize](./docs/media/visualize.png)
![Visualize](./docs/static/visualize.png)

### Mocking Interface

Mocks can be imported, exported, edited, cloned, disabled, and enabled from Deputy UI

![Mocking Interface](./docs/media/disable_mocks.png)
![Mocking Interface](./docs/static/mock_management.png)

### Full Documentation

Expand Down
4 changes: 2 additions & 2 deletions docs/content/en/assertions.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
---
title: Testing
title: Assertions
position: 10
---

Deputy can be used to in a functional or user acceptance testing environment to validate an application's functionalities without/without making requests to external services.

![Test Environment](/test_environment.png)
<img src="test_environment.png" width="1280" height="640" alt="Test Environment"/>

Requests made to/via Deputy are recorded and can be asserted against in a test environment.

Expand Down
16 changes: 8 additions & 8 deletions docs/content/en/dashboard.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ menuTitle: Dashboard
category: Getting Started
position: 3
features:
- Realtime Request Logs
- Create, Edit, Delete, Clone or Disable mocks
- Import and Export mocks
- Visualize requests and responses
- Convert proxy request-response to mock
- Realtime Request Logs
- Create, Edit, Delete, Clone or Disable mocks
- Import and Export mocks
- Visualize requests and responses
- Convert proxy request-response to mock
---

Deputy ships with a beautiful UI at http://localhost:8081 and some very useful features like:
Expand All @@ -19,19 +19,19 @@ Deputy ships with a beautiful UI at http://localhost:8081 and some very useful f

Inspect requests and responses

![logs](/logs.png)
<img src="logs.png" width="1280" height="640" alt="Logs"/>

## Request Visualization

Visualize request and responses using the auto generated sequence diagram

![visualize](/visualize.png)
<img src="logs.png" width="1280" height="640" alt="Visualize"/>

## Mock management

Quick access to mocks management straight from the UI

![visualize](/mock_management.png)
<img src="mock_management.png" width="1280" height="640" alt="Mock engagment"/>

<alert type="warning">
The Dashboard only supports JSON mocks
Expand Down
22 changes: 11 additions & 11 deletions docs/content/en/start.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ menuTitle: Start
category: Getting Started
position: 2
features:
- Start mock API server at http://localhost:8080
- Dashboard and REST API server at http://localhost:8081
- Start mock API server at http://localhost:8080
- Dashboard and REST API server at http://localhost:8081
---

## Deputy Server
Expand Down Expand Up @@ -50,13 +50,13 @@ an example `hello_world.json` file looks like:

```json
{
"request": {
"path": "/hello-word"
},
"response": {
"status": 200,
"body": "Hello"
}
"request": {
"path": "/hello-word"
},
"response": {
"status": 200,
"body": "Hello"
}
}
```

Expand Down Expand Up @@ -111,5 +111,5 @@ Using the `--tls` flag will start the mock server in https mode at `https://loca

If Deputy detects a folder called `ssl` in the current directory, it will use certificates in that folder with the names:

- `key.pem`
- `cert.pem`
- `key.pem`
- `cert.pem`
4 changes: 2 additions & 2 deletions docs/content/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"title": "Deputy - HTTP Mocking Server",
"url": "https://sayjava.github.io/deputy",
"logo": {
"light": "/logo-light.svg",
"dark": "/logo-dark.svg"
"light": "/deputy/logo-light.svg",
"dark": "/deputy/logo-dark.svg"
},
"github": "sayjava/deputy",
"twitter": "@sayjava"
Expand Down

0 comments on commit 781caeb

Please sign in to comment.