Skip to content
This repository has been archived by the owner on Nov 16, 2022. It is now read-only.

Commit

Permalink
Hello flask
Browse files Browse the repository at this point in the history
  • Loading branch information
Peri authored and perimeko committed Jun 11, 2020
1 parent 14f5320 commit c590ce7
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions cloud-function/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
from flask import Flask, request
app = Flask(__name__)

@app.route('/hello', methods=['POST'])
def hello_world():
"""Responds to any HTTP request.
Args:
request (flask.Request): HTTP request object.
Returns:
The response text or any set of values that can be turned into a
Response object using
`make_response <http://flask.pocoo.org/docs/1.0/api/#flask.Flask.make_response>`.
"""
request_json = request.get_json()
if request.args and 'message' in request.args:
return request.args.get('message')
elif request_json and 'message' in request_json:
return request_json['message']
else:
return f'Hello World2!'

0 comments on commit c590ce7

Please sign in to comment.