A trivial guestbook app

Functions for GET and POST endpoints. A redis.yaml to deploy redis on
kubernetes.  And a deploy.sh to deploy the fission functions with
routes.
This commit is contained in:
Soam Vasani
2017-01-18 15:30:51 -08:00
parent 9ffba72c11
commit 928d96c080
4 changed files with 104 additions and 0 deletions
+16
View File
@@ -0,0 +1,16 @@
#
# Handles POST /guestbook -- adds item to guestbook
#
from flask import request, redirect
import redis
# Connect to redis.
redisConnection = redis.StrictRedis(host='redis.guestbook', port=6379, db=0)
def main():
# Read the item from POST params, add it to redis, and redirect
# back to the list
item = request.form['text']
redisConnection.rpush('guestbook', item)
return redirect('/guestbook', code=303)