Getting started with APIs, ASP. NET, and Swagger in Azure Application Service, azureswagger
This article is the first in a series of tutorials to show you how to use the functions that help develop and host RESTful APIs in Azure application services. This tutorial describes how to support API metadata in Swagger format.
Learning content:
- Use the built-in tools in Visual Studio 2015 to create and deploy API applications in Azure application services.
- How to Use the Swashbuckle NuGet package to dynamically generate Swagger API metadata for automatic API discovery.
- How to Use Swagger API metadata to automatically generate the client code of the API application.
Overview of sample applications
This tutorial uses a simple to-do list sample application. This application contains the SPA front-end, ASP. NET Web API middle layer, and ASP. NET Web API data layer.
The following is the front-end screen of AngularJS.
The Visual Studio solution contains three projects:
- ToDoListAngular-Front-end: Used to call AngularJS SPA on the middle layer.
ToDoListAPI-Middle Layer: ASP. NET Web API project that calls the data layer to perform CRUD operations on service items.
ToDoListDataAPI-Data layer: ASP. NET Web API project that performs CRUD operations on service items.
The three-tier architecture is one of the multiple architectures that can be implemented using API applications. Here, we only use it for demonstration. The code in each layer is as simple as possible to demonstrate API application functions. For example, the data layer uses server memory instead of database as the persistence mechanism.
After completing this tutorial, you will create two Web API projects that start and run in the cloud Application Service API application.
The next article in this series of tutorials will deploy the SPA front-end to the cloud.
Prerequisites
ASP. NET Web API-the description in this tutorial assumes that the reader basically understands how to use ASP. NET Web API 2 in Visual Studio.
Azure account-you can open an Azure account.
Visual Studio 2015 and Azure SDK for. NET-SDK automatically install Visual Studio 2015 (if not installed ).
Download the sample application and subsequent operations. If you are interested, click here to continue reading.