import uvicorn
from starlette.middleware.cors import CORSMiddleware


from crimsy import Crimsy, Request, Router

app = Crimsy(title="Pink Pony Club API")


# add the cors middleware here since config has now been patched.
app.add_middleware(
    CORSMiddleware,
    allow_origins=["https://example.com"],
    allow_credentials=True,
    allow_methods=["*"],
    allow_headers=["*"],
)

router = Router("")


@router.get("/")
async def index(request: Request) -> str:
    return "hello"


app.add_router(router)


if __name__ == "__main__":
    uvicorn.run(app)
