Creating our first microservice
For our mobile application, in Chapter 8, Creating a Datastore with Cosmos DB, we created a simple data access proxy that retrieves data from Cosmos DB. In this exercise, we will be creating small web API components that will expose various methods for CRUD operations on our collections.
Initial setup
Let's begin our implementation:
- First, create an ASP.NET Core project:
Figure 9.2 – Creating an ASP.NET Project
- Once the project is created, do a quick test to check whether the
dotnetcore components are properly set up. - Open a console window and navigate to the project folder. The following commands will restore the referenced packages and compile the application:
dotnet restore dotnet build
- Once the application is built, we can use the
runcommand and execute aGETcall to theapi/valuesendpoint:Figure 9.3 – First Run for the ASP.NET Core App
This should result in the output of the values from the
WeatherForecastController...