fugthchat commited on
Commit
755aa6a
·
verified ·
1 Parent(s): 3838bac

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +36 -0
app.py ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from fastapi import FastAPI
2
+ from fastapi.middleware.cors import CORSMiddleware
3
+
4
+ app = FastAPI(title="FonsFlip API")
5
+
6
+ app.add_middleware(
7
+ CORSMiddleware,
8
+ allow_origins=["*"], # later lock to github.io
9
+ allow_methods=["*"],
10
+ allow_headers=["*"],
11
+ )
12
+
13
+ # Health check
14
+ @app.get("/")
15
+ def root():
16
+ return {"status": "FonsFlip backend running"}
17
+
18
+ # Listings (mock for now)
19
+ @app.get("/listings")
20
+ def listings():
21
+ return [
22
+ {
23
+ "id": 1,
24
+ "title": "Jordan 4 Retro Black Cat",
25
+ "price": 620,
26
+ "location": "Boston, MA",
27
+ "image": "https://images.unsplash.com/photo-1600185365483-26d7a4cc7519?w=600"
28
+ },
29
+ {
30
+ "id": 2,
31
+ "title": "Supreme Box Logo Hoodie",
32
+ "price": 380,
33
+ "location": "Cambridge, MA",
34
+ "image": "https://images.unsplash.com/photo-1521335629791-ce4aec67dd47?w=600"
35
+ }
36
+ ]