You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
910 B
37 lines
910 B
from fastapi import FastAPI
|
|
from fastapi.middleware.cors import CORSMiddleware
|
|
|
|
# Import all routers
|
|
from app.routes.auth import auth_router
|
|
from app.routes.friends import friends_router
|
|
from app.routes.users import users_router
|
|
from app.routes.pins import pins_router
|
|
|
|
|
|
# FastAPI app instance
|
|
app = FastAPI(
|
|
servers=[
|
|
{"url": "http://127.0.0.1:8000/api/v1", "description": "Dev environment"},
|
|
{"url": "https://api.memorymap.fr/api/v1", "description": "Production environment"}
|
|
],
|
|
root_path="/api/v1",
|
|
root_path_in_servers=False
|
|
)
|
|
|
|
origins = [
|
|
"*", # Allow all origins
|
|
]
|
|
|
|
app.add_middleware(
|
|
CORSMiddleware,
|
|
allow_origins=origins,
|
|
allow_credentials=True,
|
|
allow_methods=["*"],
|
|
allow_headers=["*"],
|
|
)
|
|
|
|
# Inclure les routeurs
|
|
app.include_router(auth_router)
|
|
app.include_router(friends_router)
|
|
app.include_router(users_router)
|
|
app.include_router(pins_router) |