You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/guides/use-case/wiremock.md
+8-9Lines changed: 8 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,8 +14,8 @@ Imagine you have both an API and a frontend app, and you want to test how the fr
14
14
In this guide, you'll learn how to:
15
15
16
16
- Use Docker to launch up a WireMock container.
17
-
-Set up a non-containerized Node app to route requests to the containerized WireMock.
18
-
-Set up a non-containerized Node app to fetch data from the external AccuWeather API.
17
+
-Use mock data in the local development without relying on an external API
18
+
-Use a Live API in production to fetch real-time weather data from AccuWeather.
19
19
20
20
## Using WireMock with Docker
21
21
@@ -91,18 +91,17 @@ Now that you have tried WireMock, let’s use it in development and testing. In
91
91
92
92

93
93
94
-
- The API Request is sent from the Node.js backend to the External AccuWeather API, which then returns the API Response.
95
-
- Alternatively, when using WireMock, a Mocked API Request is sent to the WireMock server, and a Mocked API Response is returned.
94
+
- In development, the Node.js backend sends a request to WireMock instead of the actual AccuWeather API.
95
+
- In production, it connects directly to the live AccuWeather API for real data.
96
96
97
+
## Use mock data in local development
97
98
98
-
## Set up a non-containerized Node app to route requests to a containerized WireMock
99
-
100
-
Let’s set up a non-containerized Node app to route requests to the WireMock container instead of the external AccuWeather API.
99
+
Let’s set up a Node app to send requests to the WireMock container instead of the actual AccuWeather API.
101
100
102
101
### Prerequisite
103
102
104
103
- Install [Node and NPM](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm)
105
-
- Ensure that WireMock container is up and running. (created in the previous step).
104
+
- Ensure that WireMock container is up and running. (as setup earlier).
106
105
107
106
108
107
Follow the steps to setup a non-containerized Node application:
@@ -205,7 +204,7 @@ Follow the steps to setup a non-containerized Node application:
205
204
> [!TIP]
206
205
> Before you proceed to the next step, ensure that you stop the node application service.
207
206
208
-
## Set up a non-containerized Node app to fetch data from the external AccuWeatherAPI
207
+
## Use a Live APIin production to fetch real-time weather data from AccuWeather.
209
208
210
209
To enhance your Node.js application with real-time weather data, you can seamlessly integrate the AccuWeather API. This section of the guide will walk you through the steps involved in setting up a non-containerized Node.js application and fetching weather information directly from the AccuWeather API.
0 commit comments