6.0.0 • Published 2 months ago
@agreed/cli v6.0.0
agreed is Consumer Driven Contract tool with JSON mock server.
agreed has 3 features.
- Create contract file as json(json5/yaml/etc) file
- mock server for frontend development.
- test client for backend development
Install
$ npm install agreed -g
Usage
Usage as Frontend Mock Server
- Create agreed file (this file is used as a contract between frontend and backend)
// 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
6.0.0
2 months ago
5.3.1
2 years ago
5.3.2-alpha.0
2 years ago
5.3.0
2 years ago
5.2.1
3 years ago
5.2.0
3 years ago
5.1.10
4 years ago
5.1.9
4 years ago
5.1.8
4 years ago
5.1.7
4 years ago
5.1.6
4 years ago
5.1.5
4 years ago
5.1.4
4 years ago
5.1.3
4 years ago
5.1.2
4 years ago
5.1.1
4 years ago
5.1.0
4 years ago
5.0.4
4 years ago
5.0.2
4 years ago
5.0.1
4 years ago
5.0.0
4 years ago
0.2.2
4 years ago
0.1.0
4 years ago
0.0.6
5 years ago
0.0.5
5 years ago
0.0.4
5 years ago
0.0.3
5 years ago
0.0.1
5 years ago