-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
40 lines (30 loc) · 739 Bytes
/
Copy pathapp.py
File metadata and controls
40 lines (30 loc) · 739 Bytes
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
from flask import Flask
app = Flask(__name__)
app.config["DEBUG"] = True
@app.route("/")
@app.route("/hello")
def hello_world():
return "Hello, World!"
@app.route("/test/<search_query>")
def search(search_query):
return search_query
@app.route("/integer/<int:value>")
def int_type(value):
print(value + 1)
return "correct"
@app.route("/float/<float:value>")
def float_type(value):
print(value + 1)
return "correct"
@app.route("/path/<path:value>")
def path_type(value):
print(value)
return "correct"
@app.route("/name/<name>")
def index(name):
if name.lower() == "michael":
return f"Hello, {name}", 200
else:
return "Not Found", 404
if __name__ == "__main__":
app.run()