from fastapi import FastAPI from fastapi.middleware.cors import CORSMiddleware from vntypes import Novel app = FastAPI() origins = [ "http://localhost", "http://localhost:5173", ] app.add_middleware( CORSMiddleware, allow_origins=origins, allow_credentials=True, allow_methods=["*"], allow_headers=["*"], ) @app.get("/") def read_root(): return {"Hello": "World"} @app.get("/posts/{uuid}") def get_post(uuid: str): return uuid @app.post("/new") def new_post(novel: Novel): print(novel) return "yay!"