-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmain.py
More file actions
41 lines (28 loc) · 806 Bytes
/
main.py
File metadata and controls
41 lines (28 loc) · 806 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
from fastapi import FastAPI
import echo
app = FastAPI()
@app.get("/")
async def root():
return {"message": "Hello World"}
@app.get("/hello/{name}")
async def say_hello(name: str):
return {"message": f"Hello {name}"}
@app.get("/start")
async def start():
return {"message": "Hello World"}
# get all courses
@app.get("/courses")
async def get_all_courses():
return echo.get_all_courses()
# get specific course
@app.get("/courses/{course_id}")
async def get_course(course_id: int):
return echo.get_course(course_id)
# get the quiz list of specific course
@app.get("/courses/{course_id}/quiz")
async def get_quiz(course_id: int):
return echo.get_quiz(course_id)
# get timeline
@app.get("/timeline")
async def get_timeline_content():
return echo.get_timeline_content()