Creating the service
There are many ways to create a service, such as via REST or perhaps gRPC. In this book, we will cover REST.
For those who haven't worked with REST before, REST stands for REpresentational State Transfer. Simply put, it is a way for machines to talk to other machines using HTTP.
With REST, we use different HTTP verbs for different operations. It could look something like this:
This is what we are going to implement for tags, categories, and blog posts.
Since the API takes care of whether the post should be created, we'll cheat a little bit and only implement Put (replace) because we don't know whether we are creating or updating the data.
The API will only be used by Blazor WebAssembly, so we will implement the API in the MyBlogWebAssembly.Server
project.
Adding database access
Execute the following steps to provide database access:
- In the
MyBlogWebAssembly.Server
project, openStartup.cs
.
...