-
Notifications
You must be signed in to change notification settings - Fork 0
/
testFlask.py
45 lines (34 loc) · 1.03 KB
/
testFlask.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
39
40
41
42
43
44
45
from flask import Flask, render_template, jsonify
app = Flask( __name__ )
@app.route( '/' )
def home():
return render_template( 'home.html' )
@app.route( '/about' )
def about():
return render_template( 'about.html' )
@app.route( '/contact' )
def contact():
return render_template( 'contact.html' )
@app.route( '/birthday' )
def birthday():
return 'November 2, 1999'
@app.route( '/greeting/<name>' )
def greeting( name ):
return 'Hello ' + name + '!'
@app.route( '/add/<int:num>/<int:numTwo>' )
def add( num, numTwo ):
sum = num + numTwo
return str( sum )
@app.route( '/multiply/<int:num>/<int:numTwo>' )
def multi( num, numTwo ):
product = num * numTwo
return str( product )
#return output
@app.route( '/subtract/<int:num>/<int:numTwo>' )
def subtract( num, numTwo ):
diff = num = numTwo
return str( diff )
@app.route( '/favoritefoods' )
def faveFood():
faves = ['ravioli', 'lasanga', 'nutella', 'ramen soup']
return jsonify( faves )