First, install node.js and Serverless, then run these commands:
git clone git@github.com:minibikini/serverless-redis-example.git
cd serverless-redis-example
npm install
serverless project init
Then, add the Redis URL the the project variables (_meta/variables/s-variables-common.json
), example:
{
"project": "serverless-redis-example",
"redisServer": "//:PASSWORD@REDIS_HOST:PORT"
}
Run:
serverless function deploy
serverless endpoint deploy
curl -H "Content-Type: application/json" -X POST --data '{"value": "hey redis"}' https://ENDPOINT
curl https://ENDPOINT