Must Have API Controllers!

Опубликовано: 07 October 2024
на канале: ScriptBytes
190
14

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: https://www.threads.net/@scriptbytes

Check out my blog!
https://scriptbytes.io/