Sample REST API using Express and Redis for managing key-value pairs
- NodeJS 16.x
- Redis 6.x
npm install- Download and install dependenciesnpm run test- Placeholder for unit testsnpm run watch- Run the application in development modenpm run start- Run the application in production mode
-
PUT /data/:key/:value- Description: Insert/Update value for the given key
- Example Response:
{"status":"OK"}
-
GET /data/:key- Description: Get value for the given key from the datastore (returns null if key not found)
- Example Response:
{"status":"OK","data":"value from redis"}
Environment variable configuration items:
PORT- Port for API to listen on (default:3000)REDIS_HOST- Redis host to use (default:localhost)REDIS_PORT- Redis port to use (default:6379)