appendix B Setting up project requirements for consumer contract testing (web applications)
This appendix contains a comprehensive step-by-step guide on how to set up the project requirements for consumer-based contract testing, especially for web applications. Sections B.1 and B.2 cover how to install Node and pact-js. On the other hand, section B.3 covers how to fork (using Git and GitHub) or download the example project that we’ll be using for the hands-on exercises for this book. If you also need to install a code editor, section B.4 covers how to download Visual Studio Code (VS Code).
B.1 Installing node
To use Pact locally on your machines, you first need to have Node installed. Node is a JavaScript runtime that is known for its nonblocking and event-driven architecture.
Definition Node documentation refers to Node.js as an open source and cross-platform JavaScript runtime environment (https://nodejs.org/en).
Node allows you to write JavaScript code that runs directly in a computer process instead of in a browser. Historically, JavaScript could only be used for web development and client-side scripting. The introduction of Node means that you can now also use JavaScript for server-side scripting. Because Node is asynchronous, you can perform tasks concurrently and more efficiently. Instead of waiting for a task to complete before moving on, the program can continue executing other tasks while waiting for the asynchronous task to finish.