I wrote yet another asp.net core web API boiler plate code considering the best practices in mind to achieve optimal performance.
Some of the middle ware or services used within the code may initially seem unnecessary but will prove useful when moving forward to production ready API state.
Disclaimer: Repository and data is about English Monarchs (preparing for life in the UK test now a days, so English Monarchy is on top of my head all the time)
Below is brief overview of structure of project:
To do the authorization based on tokens, clients can generate tokens, some operations are admin based so for that has to create admin based token. It includes Token Generator, which shouldn’t be part of it but for ease i included.
For ease of testing, i kept GetAll method anonymously accessible
To allow different origin requests
download redis from here
https://redis.io/download
Redis is in-memory database used for caching, super fast and reliable. I implemented that only for demo purpose.
For having different versions of services, its necessary to know best practices
For me its WSDL for REST full services
some English monarchs tenures data (preparing for life in the uk test now a days, so monarchy is on top of my head all the time)
Handle exception handling by logging problems only
Preferably use Hosting server based compression like IIS, Apache, Nginx but useful if Hosting on Kestrel or HTTP.sys server
To restrict number of request to avoid basic level of DOS attacks and crawlers
for EU GDPR regulations
asp.net core offers built in health checks libraries
.net core comes with built in logger but thats very limited, I used SeriLog library as its faster than others like NLog and Log4net and provides structured logs. logging is backbone of any production based APIs so has to be very careful with that what you choose.
We use cookies to give you the best online experience. Please let us know if you agree to all of these cookies.