Adding Envoy

microservices csharp aspnetcore

The Backend-for-frontend(BFF) pattern is one of the ways you can protect your services from the outside world. A BFF application sits in front of your services providing a service to a front-end web application or a mobile application. The BFF application knows about the service architecture and makes calls to it while the front-end app makes calls to the BFF application. One way to achieve this is to use a reverse proxy like envoy.

More References

Sample Application

Code Changes

  • Web.Bff.Sample - Added the new Bff application. This application is configured to call SampleAp1 and SampleApi2 to fetch data.

  • SampleWebApp - The code in PersonController has changed and now calls the BFF applicaton to get Person data.

  • envoy.yaml - This is the reverse proxy that configures the api gateway. The BFF application uses the urls configured in this file to make calls to the apis.

Verification

  • Test the SampleApi1Controller using the swagger file of the Web.Bff.Sample application.

  • Test the PersonController using the swagger file of the SampleWebApp application.

  • The SampleApi1 and the SampleApi2 service should not be accessible.