Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@agreed/cli

Package Overview
Dependencies
Maintainers
2
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@agreed/cli

Agreed is a tool for Consumer Driven Contract with JSON mock server

  • 6.0.0
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
94
decreased by-27.69%
Maintainers
2
Weekly downloads
 
Created
Source

Build Status

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 -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

Keywords

FAQs

Package last updated on 14 Mar 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc