Giter VIP home page Giter VIP logo

example-consumer's Introduction

Example Consumer

Build

Pact Status (latest pact)

Can I deploy Status

This is an example of a Node consumer using Pact to create a consumer driven contract, and sharing it via PactFlow.

It is using a public tenant on PactFlow, which you can access here using the credentials dXfltyFMgNOFZAxr8io9wJ37iUpY42M/O5AIZWxelWbLvqMd8PkAVycBJh2Psyg1. The latest version of the Example Consumer/Example Provider pact is published here.

The project uses a Makefile to simulate a very simple build pipeline with two stages - test and deploy.

  • Test
    • Run tests (including the pact tests that generate the contract)
    • Publish pacts, associating the consumer version with the name of the current branch
    • Check if we are safe to deploy to prod (ie. has the pact content been successfully verified)
  • Deploy (only from master)
    • Deploy app (just pretend for the purposes of this example!)
    • Record the deployment in the Pact Broker

Usage

See the PactFlow CI/CD Workshop.

Running the application

Start up the provider (or another compatible provider) API by running npm run start.

Open a separate terminal for the consumer.

Before starting the consumer, create a .env file in the root of the project and set the URL to point to your running provider:

REACT_APP_API_BASE_URL=http://localhost:8080

Then run:

npm run start

Pre-requisites

Software:

Environment variables

To be able to run some of the commands locally, you will need to export the following environment variables into your shell:

Usage

Pact use case

  • make test - run the pact test locally
  • make fake_ci - run the CI process locally

example-consumer's People

Contributors

bethesque avatar you54f avatar mefellows avatar dependabot[bot] avatar b3nnyl avatar josephbjoyce avatar uglyog avatar timothyjones avatar mend-for-github-com[bot] avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.