You need to be a premium member to use this feature. To access it, you'll have to upgrade your membership.
Become a sharper developer and jumpstart your career.
$0
$
. 00
monthly
For Basic members:
$10
For Premium members:
If you are developer, tester or a manager, sometimes understanding the various methods of API can be a challenge when building and consuming the application.
Generating good documentation and help pages for your Web API, using Swagger with .NET Core is as easy as adding a couple of NuGet and modifying the Startup.cs
Let’s start downloading simple To-do projects from Github.
Add the Swagger generator to the service collection after services.AddMvc();
Enable the middleware for serving the generated JSON document after app.UseStaticFiles();Add the below background yellow lines in your Startup file.
NoteYour local port number may be different than ours, use your local port number. Click on Try it out and you will see the response in Response body section. Here is the Web API
NOTE
We have two controller files, TodoController and TodoApiController. TodoController is MVC Controller and Swagger did not show the API methods, because it does not know how to route and also controller methods return a View.
Summary
In this article, we learned,
NOTEIf you need to copy and paste the code download the pdf file locally.
Download source code from GitHub.
Pro WPF: Windows Presentation Foundation in .NET 3.0