Search code examples
javascriptnode.jsspringspring-cloud-contractcontract

Spring Cloud Contract - Node.js as producer


My team is creating 2 microservices. One in Spring - consumer and another in Node.js - producer. They will communicate through http rest api.

We would like to test them using contract. I've seen https://spring.io/blog/2018/02/13/spring-cloud-contract-in-a-polyglot-world but it's a different case (producer is on Java side and consumer is on Js).

Is there a way to define contract and generate tests for both microservices in such case?


Solution

  • You can generate a standard contract test with the spring cloud contract plugin. You will also generate stubs and push them out. On the consumer side you can use the docker spring cloud stub runner image to run the stubs.