Skip to content
Projects

About

agreed is Consumer Driven Contract tool with JSON mock server.

Developer Tools

How these counts are measured

Measured star growth

in 24h
0
in 7 days
0
in 15 days
-1
in 1 month
Collecting history

Net star changes over overlapping periods, not daily totals. Missing measurements are left blank. Stars measure attention, not software quality.

README.md

Original

Node.js CI

agreed is Consumer Driven Contract tool with JSON mock server.

agreed has 3 features.

  1. Create contract file as json(json5/yaml/etc) file
  2. mock server for frontend development
  3. 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)
// 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

Explore related projects

Loading…