If you are a .NET engineer looking for building a cool Web API (REST), this article is for you.
Few years ago, me and Cedric Yao created a simple
dotnet new web api template. I personally found it very useful in quickly bootstrapping a simple ASP.NET Core Web API application, especially while working with several customers. I have also received positive feedbacks from the users of it, together with some suggestions and improvements. This encouraged me to spent some of my personal hours on it, so as to help the community.
Keeping the existing one, a simple template by itself, I started creating another one with some cool features, patterns and practices, which I learnt along the journey of building .NET applications. And finally, I was able to publish it today. You can find it here
can help developers to start writing code for business features, right after using it, which is key takeaway that you get out it.
Other features that this template contains within it are …
Well tested (built using TDD). In addition, all available unit & integration tests can also be used as code references for engineers who are new to writing unit/integration tests.
Unit tests are integrated to generate Cobertura Code Coverage results.
MediatR, a simple mediator implementation for .NET. I love the usage of this tool which reduces tight coupling between code components.
Serilog is used for structured logging capability and custom injection of additional properties for better diagnostics.
In addition to xml documentation, APIs are well documented using Swagger Annotations, a testable way of documentation, rather than xml based documentation.
Uses Uri based API versioning, learn more here
Usage of sample
Responseheaders. Optional to modify as needed, based on the need.
Standardized error responses, using ProblemDetails
Fluent validation, instead of ASP.NET framework model validation
Usage of a global versioniong of all nuget dependencies across the projects.
ASP.NET Health checks, a sample implementation included.
Want to try? Please follow the readme here
Hope it helps!
Love helping the community!
comments powered by Disqus