Make sure you have NodeJS
and npm
installed on your machine.
Clone the project using
git clone https://github.com/WajeehZantout/express-gateway-demo
and run:
npm install
To start the proxy server, use
npm start
To mock your API, we are using here a tool called WireMock
.
You can download it from this link.
When downloaded, you need to make sure you have JDK isntalled. If not, please download JDK
Navigate to the folder where you have the .jar
file of wiremock and run the following command:
java -jar wiremock-standalone-2.14.0.jar --port 9999 --root-dir "<PROJECT_PATH>\express-gateway-demo\wiremock"
After running this command, it will create two folders inside the specified directory (__files
& mappings
). mappings
should contain Service files with either .json
or .java
extensions.
Restart WireMock to get the latest changes into the server Using tools like Postman or Restlet, perform a post request to http://localhost:9999/__admin/mappings/reset
with an empty body.
You have a fully configured version of WireMock that accepts GET
, POST
and PUT
requests.
You're ready to go from here.
To shut the server down, send an empty POST
request to http://localhost:9999/__admin/shutdown
. For additional information, refer to the API admin documentation here