-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.py
38 lines (29 loc) · 820 Bytes
/
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import os
from flask import Flask,request,jsonify
from buzz import generator
app = Flask(__name__)
@app.errorhandler(404)
def page_not_found(error):
return 'Rota com problema {}'.format(request.url), 404
@app.route("/buzz")
def generate_buzz():
page = '<html><body><h1>'
page += generator.generate_buzz()
page += '</h1></body></html>'
return page
@app.route("/name")
def generate_name():
page = '<html><body><h1>'
page += 'Hi I Am Pavan.'
page += '</h1></body></html>'
return page
@app.route("/")
@app.route("/index")
def index():
return 'Flask is running!'
@app.route('/data')
def names():
data = {"names": ["John", "Jacob", "Julie", "Jennifer"]}
return jsonify(data)
if __name__ == "__main__":
app.run(host='0.0.0.0', port=int(os.getenv('PORT', 5000)))