Building RESTful Web Services with .NET Core
上QQ阅读APP看书,第一时间看更新

Service-oriented architecture

Like SPA, Web API plays an important role in service-oriented architecture (SOA). As the name suggests, it is an architecture methodology that deals with separation of responsibility from a business-oriented point of view into independent services. Often, these independent services or components can be designed using RESTful Web APIs.

Consider an e-commerce application that would have different components such as ordering, billing, payment processing, customer profile management, and so on. Each of these components has its own business logic and can be implemented independently.

The following diagram represents a pictorial view of such an application having independent components:

To make them independent, RESTful APIs can be exposed for these components, which can be easily consumed by any client/application including other components as well, as long as they satisfy the authentication and authorization.

Following is a pictorial representation of a monolithic or traditional application architecture versus SOA. It's perfectly clear how SOA introduces reusable components for the same business application. Moreover, implementing them with Web API brings the capability to expose that to outside for consumption by any application:  

SOA implementation is beyond the scope of this book because there is a lot of stuff about Web API we need to explore in the next chapters. Whatever we do with the application in this book would use one Web API, but you can separate them out to build a more scalable architecture.