I have a flask app with several API endpoints. I want to add a new endpoint that checks the server status and return a message (e.g. server is under maintenance or available).
My question is how do I know that the server is under maintenance and test this route on local?
Any HTTP API responds with meaningful Status Codes and Status Messages. In particular:
The ok read-only property of the Response interface contains a Boolean stating whether the response was successful (status in the range 200-299) or not.
if(response.ok){
The API is alive!
}