Elffuss BraidHub

kikocis/continue public

3ff29c567dd0 · 813 BRawPermalink
1from fastapi import FastAPI
2
3app = FastAPI()
4
5@app.get("/")
6def read_root():
7\treturn {"Hello": "World"}
8
9@app.get("/landing")
10def read_landing_page():
11\treturn {"message": "Welcome to the landing page"}
12
13---
14
15from fastapi import FastAPI, HTTPException
16
17app = FastAPI()
18
19@app.get("/")
20def read_root():
21 return {"Hello": "World"}
22
23@app.get("/landing")
24def read_landing_page():
25 raise HTTPException(status_code=404, detail="Page not found")
26
27---
28
29- from fastapi import FastAPI
30+ from fastapi import FastAPI, HTTPException
31
32 app = FastAPI()
33
34 @app.get("/")
35 def read_root():
36- \treturn {"Hello": "World"}
37+ return {"Hello": "World"}
38
39 @app.get("/landing")
40 def read_landing_page():
41+ raise HTTPException(status_code=404, detail="Page not found")
42- \treturn {"message": "Welcome to the landing page"}