Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/recruit-tech/agreed
agreed is Consumer Driven Contract tool with JSON mock server.
https://github.com/recruit-tech/agreed
mock-server
Last synced: about 11 hours ago
JSON representation
agreed is Consumer Driven Contract tool with JSON mock server.
- Host: GitHub
- URL: https://github.com/recruit-tech/agreed
- Owner: recruit-tech
- Created: 2016-08-05T08:26:42.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2024-09-17T11:41:43.000Z (about 2 months ago)
- Last Synced: 2024-09-18T04:07:36.032Z (about 2 months ago)
- Topics: mock-server
- Language: JavaScript
- Homepage:
- Size: 16 MB
- Stars: 215
- Watchers: 8
- Forks: 18
- Open Issues: 17
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
#
![Node.js CI](https://github.com/recruit-tech/agreed/workflows/Node.js%20CI/badge.svg)
agreed is Consumer Driven Contract tool with JSON mock server.
agreed has 3 features.
1. Create contract file as json(json5/yaml/etc) file
1. mock server for frontend development
1. test client for backend development# Install
```
$ npm install @agreed/cli -g
```# Usage
## Usage as Frontend Mock Server
- Create agreed file (this file is used as a contract between frontend and backend)
```javascript
// save as agreed.js
module.exports = [
{
request: {
path: '/user/:id',
method: 'GET',
query: {
q: '{:someQueryStrings}',
},
values: {
id: 'yosuke',
someQueryStrings: 'foo'
},
},
response: {
headers: {
'x-csrf-token': 'csrf-token',
},
body: {
message: '{:greeting} {:id} {:someQueryStrings}',
images: '{:images}',
themes: '{:themes}',
},
values: {
greeting: 'hello',
images: [
'http://example.com/foo.jpg',
'http://example.com/bar.jpg',
],
themes: {
name: 'green',
},
}
},
},
]
```- Run server
```
$ agreed-server --path ./agreed.js --port 3010
```- curl to the mock server
```
$ curl http://localhost:3010/user/yosuke?q=foo
{
"message": "hello yosuke foo",
"images": [
"http://example.com/foo.jpg",
"http://example.com/bar.jpg"
],
"themes": {
"name": "green"
}
}
```## Usage as Backend test client
- Run test client for confirm response
```
$ agreed-client --path ./agreed.js --port 3030 --host example.com
```## Usage: Agreed Documentation
- Run documentation server
```
$ agreed-ui --path ./agreed.js --port 3031
```![ScreenShot](https://raw.githubusercontent.com/recruit-tech/agreed-ui/master/screenshot.png)