This is part of a personal ASP.NET Core cookbook that i am working on.
Open an existing asp.net core 5 razor pages app.
Add Swashbuckle.AspNetCore via nugget. This will auto generate api docs, cool right?
Update Startup.cs to include controller and swagger services and middlewares.
At project root, add Controllers directory then open context menu under that folder by selecting the folder and right click.
On context menu, click add > controller
A new dialog window will open for scaffolding options.
Select API.
Run project then go to https://localhost:PORT/swagger
There you have it, happy hacking.
Top comments (0)