File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ from fastapi import FastAPI
2+ from fastapi .middleware .cors import CORSMiddleware
3+ from fastapi_pagination import add_pagination
4+ from sqlalchemy .exc import IntegrityError
5+
6+ from app .api .v1 import routes_atletas , routes_categorias , routes_centros
7+ from app .exceptions .handlers import integrity_error_handler
8+
9+ app = FastAPI (title = "WorkoutAPI" , version = "0.1.0" , description = "API de competição de crossfit" )
10+
11+ # CORS (ajuste permissões conforme sua política)
12+ app .add_middleware (
13+ CORSMiddleware ,
14+ allow_origins = ["*" ],
15+ allow_credentials = True ,
16+ allow_methods = ["*" ],
17+ allow_headers = ["*" ],
18+ )
19+
20+ # Routers
21+ app .include_router (routes_atletas .router )
22+ app .include_router (routes_categorias .router )
23+ app .include_router (routes_centros .router )
24+
25+ # Exception handlers
26+ app .add_exception_handler (IntegrityError , integrity_error_handler )
27+
28+ # FastAPI-pagination
29+ add_pagination (app )
You can’t perform that action at this time.
0 commit comments