The elements of our reference architecture that we have touched on so far are illustrated in the following figure:
![](assets/e3fcf5a7-f7ca-4143-ab39-8b788987765e.png)
We have implemented a frontend web layer with a single backend service.
When our frontend page renders the user is presented with a standard web form. When they press Submit a standard HTTP post request is made to our API tier, which is implemented using the Express framework.
We implemented a route in our API tier that uses restify to make a connection to our microservice. This route marshals parameters from the original form POST request and sends them onto our microservice via an HTTP GET request. Once the service has returned a result, our Express application renders it using our EJS template.
Of course, for a small system like this it is hardly worth going to the trouble. However, this is just for illustrative purposes. As a system grows in functionality the benefits of this type of architectural approach become more apparent.
It's also important to note the reason for the API tier (the Express application): minimizing the public API surface area.
We strongly recommended that microservices are never directly exposed to the client tier, even on protected networks. Instead prefer to use an API gateway pattern (like we've built in this recipe) to minimize the attack surface.
The following recipes will go on to build on more elements of our system, however, before we do so our next recipe will look at how we can configure an effective local development environment.