Elffuss BraidHub

kikocis/continue public

main · 788 BRawPermalink
1from fastapi import FastAPI
2
3app = FastAPI()
4
5@app.get("/")
6def read_root():
7 return {"Hello": "World"}
8
9@app.get("/landing")
10def read_landing_page():
11 return {"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 return {"Hello": "World"}
37
38 @app.get("/landing")
39 def read_landing_page():
40+ raise HTTPException(status_code=404, detail="Page not found")
41- return {"message": "Welcome to the landing page"}