Services for Native Apps
As stated earlier, smartphones had an important part in the trend toward simpler pure HTTP APIs and away from
Soap. Many of the native apps can be likened to dumb terminals connected to a big mainframe, with the mainframe
Being the cloud. In these apps, the cloud provides storage and server-side processing and the app are mainly used for
The consumption of the services exposed by an API.
If you is thinking of building an app for smartphones, you should seriously consider exposing your backend
Services through a REST API using the ASP. NET Web API.
self-hosted HTTP Server
Before ASP. NET Web API, there is no easy-to-host a simple WEB server in your Windows service or desktop
Application. If you needed to the host a service, you had to use WCF, which is not ideal.
The ASP. NET Web API has the made it extremely easy-to-host your API in a Nonweb server process. Most of the code
You need to write are exactly the same as the code you would write in a web-hosted scenario. can also use the
self-hosted Web API Server to serve static resources or even a server-rendered view (e.g., Razor) so can serve
Web pages. A common scenario is if you had a process running as a Windows service and you need a
Web-based Administration console for it with which case the self-hosted Web API are all you need.
ASP. NET Web API and other architectural aspects
In the past few years, the software world have experienced a massive change and a huge influx of ideas and practices
(Cloud, DevOps, BDD, SPA, Big Data, etc). ASP. NET Web API was born in a landscape of very heterogenous
Architectural patterns. There is emerging trends in the community so whether we like it or not, is going to affect
How we'll be using the ASP. NET Web API.
This by itself is a big subject, and we were only going to scratch the surface here, but it's important to provide
Pointers relevant to the rest of this book!
ASP. Net-Web-API and ASP
As stated earlier, there is a considerable similarity between ASP. NET Web API and ASP. Have said that,
There is isn't a great deal of functional overlap between them, but a question that crops up time and time again is the
Choice between these, independent frameworks.
If you have tried the ASP. NET Web API template in the Visual Studio, you are probably noticed that the this template
Combines ASP. NET Web API and ASP. In fact, nothing stops your from using both of these frameworks in the
Same project. But you need to be clear on what the main value of each framework is.
ASP. NET MVC is ideal for generating server-side views (Razor or Web Forms). And in terms of processing
Client-side data, it is mainly geared toward x-www-form-urlencoded data (Form post data). Although ASP. NET Web API
can process x-www-form-urlencoded data and can generate Razor views, it's best for exposing an API.
If you had both these requirements in a project, use both frameworks in conjunction.
ASP. NET Web API and DDD
Since its formalization in 2003, Domain-driven Design (DDD) have provided the vocabulary, semantics, and conceptual
Tools for designing and architecting modern software. Eric Evans introduced DDD in he book Domain-driven
Design:tackling complexity in the heart of Software (Addison-wesley 2003), which have earned classic status among
Computer software books along with the Gang of four Design patterns book (design patterns:elements of REUSABLE
object-oriented software, by Erich Gamma et al., Addison-wesley 1994) and Martin Fowler ' s Patterns of Enterprise
Application Architecture (Addison-wesley 2002).
Introduction to ASP Web API