Every time I create a new API, I always end up adding these two controllers.
One is a /status controller, which does health checks on various parts of my API and responds if everything is ok. I then call these endpoints from a monitoring tool to check on the status of my API.
The other is an /errors controller, which will respond with a given error code whenever an endpoint is called. I use this from my user interfaces to ensure that the users have a good experience when something goes wrong on the backend.
I show how I implement these in a .Net 7 API.
Follow me on social media!
Twitter: / scriptbytesio
Instagram: / scriptbytes
Threads: www.threads.ne...
Check out my blog!
scriptbytes.io/
27 авг 2024