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:
- Once the project is created, do a quick test to check whether the
dotnet
core 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
run
command and execute aGET
call to theapi/values
endpoint:This should result in the output of the values from the
WeatherForecastController...