Testing the service
To run the service, the OpenAPI test page can be used. However, there’s a better way without leaving Visual Studio or Visual Studio Code. Visual Studio offers the Endpoints Explorer window to show all the API endpoints in your solution, as shown in Figure 2.6. Open this window using View | Other Windows | Endpoints Explorer:
Figure 2.6 – Endpoints Explorer
By selecting an endpoint and opening the context menu, you can generate a request. This creates an HTTP file that you can use to send HTTP requests, including the body, and see the returned results beside it.
Using HTTP files with Visual Studio Code
If you use Visual Studio Code, install the REST Client
extension from Huachao Mao.
First, we start a game by sending a POST
request:
Codebreaker.GameAPIs/Codebreaker.GameAPIs.http
@HostAddress = http://localhost:9400 @ContentType = application/json ### Create a game POST {{HostAddress}}/games/ Content-Type...