Custom Status
Using a custom status can give the user more insight on your service e.g. if it is undergoing maintenance etc.
How to get a custom status
Using script.js
When using script.js you can make a response from your server route whose URL is defined in data.json
like this:
This example is written in Node.js using express
app.js
const express = require('express');
const app = express();
app.get('/', (req, res) => {
res.set('Content-Type', 'application/json');
res.send('{ status: { statusText: "disabled", color: "orange" } }');
});
app.listen(3000, () => console.log("Server running on port 3000"));
Custimzable values:
Value Name | Key | Type | Default |
---|---|---|---|
Status Text | statusText | String | undefined |
Color | color | "red" | "orange" | "green" | "orange" |
Using a custom script
When using a custom script you can handle the colors yourself and therefore enter any String value.
Note that only statusText
and color
will be passed to the response to the client.
A instruction on how to destructure the custom status from the API response on the client can be found here.