Skip to content
Bryan Kendall edited this page Jan 5, 2015 · 3 revisions

I realized we merged this in but there is very limited documentation on how to put a status message in the API /status route, so here’s the quick rundown:

The data is stored in a hash in redis under the key process.env.REDIS_NAMESPACE + status-message. For this example, REDIS_NAMESPACE is going to be api-prod:.

The /status route will return an empty object if there is no has set in redis. Otherwise, it will return a data object reflecting exactly what is in redis. There is one special key, statusCode that will change the response’s status code away from 200 if you set it.

To remove the status message from the /status route, simply delete (DEL) the entire key.

Full examples

In redis:

> hset api-prod:status-message statusCode 418
> hset api-prod:status-message message “Yes, I’m a teapot”

This will produce the following response from the API:

GET /status
Code: 418
Body:
{
  “statusCode”: “418”,
  “message”: “Yes, I’m a teapot”
}

Or, alternatively:

In redis:

> hset api-prod:status-message message “Planned maintenance on Tuesday”

This will produce the following response from the API:

GET /status
Code: 200
Body:
{
  “message”: “Planned maintenance on Tuesday”
}
Clone this wiki locally