David Prince
fix: add all missing local module stubs (remote_mcp_registry, mcp_auth, mcp_transport, etc)
cce8120 | from fastapi import FastAPI, HTTPException | |
| from fastapi.middleware.cors import CORSMiddleware | |
| from . import models, schemas, crud, database | |
| app = FastAPI(title="Test API") | |
| origins = ["http://localhost:5173", "http://127.0.0.1:5173"] | |
| app.add_middleware( | |
| CORSMiddleware, | |
| allow_origins=origins, | |
| allow_credentials=True, | |
| allow_methods=["*"], | |
| allow_headers=["*"], | |
| ) | |
| async def startup(): | |
| await database.init_db() | |
| async def create_item(item: schemas.ItemCreate): | |
| return await crud.create_item(item) | |
| async def read_items(skip: int = 0, limit: int = 100): | |
| return await crud.get_items(skip=skip, limit=limit) | |
| async def read_item(item_id: int): | |
| db_item = await crud.get_item(item_id) | |
| if db_item is None: | |
| raise HTTPException(status_code=404, detail="Item not found") | |
| return db_item | |
| async def update_item(item_id: int, item: schemas.ItemUpdate): | |
| db_item = await crud.update_item(item_id, item) | |
| if db_item is None: | |
| raise HTTPException(status_code=404, detail="Item not found") | |
| return db_item | |
| async def delete_item(item_id: int): | |
| db_item = await crud.delete_item(item_id) | |
| if db_item is None: | |
| raise HTTPException(status_code=404, detail="Item not found") | |
| return db_item | |