Adding the Swagger UI to your application

Downloading the Swagger file and reading it can be a complex task for human beings. For us, it's much easier to see a visualization of the API in a nice, automatically generated UI, where we could easily see if the API is what we expect it to be.

Part of the Swashbuckle package you installed contains the Swagger UI, which is one of tools in the Swagger toolkit. To use it, add the following lines to the Configure method in the Startup class and specify the relative URL of the Swagger file in your API:

app.UseSwaggerUI(c =>
{
c.SwaggerEndpoint("/swagger/v1/swagger.json", "GiveNTake.API");
});

Run the application and browse to http://localhost:[port]/swagger. You should see a page similar to this:

The UI is separated into sections that conform to the controllers in your application. For each controller section, you'll find the actions and can drill into them to see their definitions and test them.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.118.142.166