A Redis REST API with NodeJS using Expressjs and Redis, Inspired by lucianostraga/heroku-redis-node-rest-api.
You can deploy your own copy of the app using the web-based flow:
Click on "Deploy to Heroku" button above and follow the instructions:
- Enter an application name
- Choose a region
- Update config vars or leave default values
You can customize the button, for example you might have the following button URL:
<a href="https://heroku.com/deploy?template=https://github.com/velizarn/heroku-redis-api/tree/main&
env[WHITELIST_IP]=11.11.11.11">Deploy to Heroku</a>
This will cause the Heroku app-set interface to prefill IP address for the WHITELIST_IP environment variable and to use specific branch from your repo.
The app name argument is optional. If no app name is specified, a random name will be generated. Since Heroku app names are in a global namespace, you can expect that common names, like “blog” or “wiki”, will already be taken. It’s often easier to start with a default name and rename the app later.
You can deploy to DigitalOcean by clicking the button below:
You can deploy to Render.com by clicking the button below:
You can deploy to Scalingo by clicking the button below:
Navigate to https://gitpod.io/#https://github.com/velizarn/heroku-redis-api and follow the instructions. After installation create .env file in your workspace with following parameters:
LOG_LEVEL=info
REDIS_APPKEY_PREFIX=
REDIS_URL=redis://127.0.0.1:6379
WHITELIST_IP=
The most important parameter is REDIS_URL. After creating .env file restart the application, if needed.
-
Install Javascript dependencies (via yarn or npm)
-
Create .env file with required params, refer to .env.sample
-
Start the application (npm run start)
- GET /help
- Displays all available endpoints
- GET /info
- Returns information and statistics about the server
- GET /insomnia.json
- Returns data to import a ready-to-use collection into Insomnia Core
- GET /keys
- Returns all keys, optionally you can set a pattern, e.g. /keys?pattern=name*
- GET /get?key=
- Get the value of key. If the key does not exist the special value nil is returned. An error is returned if the value stored at key is not a string, because GET only handles string values.
- GET /type?key=
- Returns the string representation of the type of the value stored at key.
- GET /ttl?key=
- Returns the remaining time to live of a key that has a timeout.
- POST /del
- Removes the specified key/s, e.g. keys=foo, keys=foo1,foo2,foo3, etc. A key is ignored if it does not exist.
MIT