-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
42 lines (36 loc) · 775 Bytes
/
app.py
File metadata and controls
42 lines (36 loc) · 775 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
41
42
from flask import Flask, render_template, jsonify
app = Flask(__name__)
JOBS = [
{
"id": 1,
"title": "Data Analyst",
"location": "Toronto, Canada",
"salary": "CAD $100,000"
},
{
"id": 2,
"title": "Data Scientist",
"location": "Toronto, Canada",
"salary": "CAD $130,000"
},
{
"id": 3,
"title": "Frontend Engineer",
"location": "Toronto, Canada",
"salary": "CAD $110,000"
},
{
"id": 4,
"title": "Backend Engineer",
"location": "Toronto, Canada",
"salary": "CAD $120,000"
},
]
@app.route("/")
def hello():
return render_template("home.html", jobs=JOBS)
@app.route("/api/jobs")
def list_jobs():
return jsonify(JOBS)
if __name__ == "__main__":
app.run(host="0.0.0.0", debug=True)