Manage your app's status with a file.
options
is an optional object that can contain:
{
"offline": "maintenance",
"online": "production",
"path": "./check.txt",
"leave": false,
"startOffline": false
}
The string that will be written to check.txt when your app is offline. Defaults to maintenance
The string that will be written to check.txt when your app is online. Defaults to production
The path to check.txt. Defaults to ./check.txt
If leave is not set to true, CheckMagic will remove check.txt when the process exits. Defaults to false
If startOffline is not set to true, you will need to call goOnline
to indicate your server is online. Defaults to false
Returns the contents of check.txt as a string. If check.txt is inaccessible it will return your offline string.
Writes your offline string to check.txt
Writes your online string to check.txt