|
|
from fastapi import FastAPI |
|
|
from fastapi.middleware.cors import CORSMiddleware |
|
|
|
|
|
app = FastAPI(title="FonsFlip API") |
|
|
|
|
|
app.add_middleware( |
|
|
CORSMiddleware, |
|
|
allow_origins=["*"], |
|
|
allow_methods=["*"], |
|
|
allow_headers=["*"], |
|
|
) |
|
|
|
|
|
|
|
|
@app.get("/") |
|
|
def root(): |
|
|
return {"status": "FonsFlip backend running"} |
|
|
|
|
|
|
|
|
@app.get("/listings") |
|
|
def listings(): |
|
|
return [ |
|
|
{ |
|
|
"id": 1, |
|
|
"title": "Jordan 4 Retro Black Cat", |
|
|
"price": 620, |
|
|
"location": "Boston, MA", |
|
|
"image": "https://images.unsplash.com/photo-1600185365483-26d7a4cc7519?w=600" |
|
|
}, |
|
|
{ |
|
|
"id": 2, |
|
|
"title": "Supreme Box Logo Hoodie", |
|
|
"price": 380, |
|
|
"location": "Cambridge, MA", |
|
|
"image": "https://images.unsplash.com/photo-1521335629791-ce4aec67dd47?w=600" |
|
|
} |
|
|
] |
|
|
|