-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmain.py
More file actions
31 lines (27 loc) · 1016 Bytes
/
main.py
File metadata and controls
31 lines (27 loc) · 1016 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
from app.routers.weather import router as weather_router
from app.routers.activitySuggestions import router as activity_suggestions_router
from app.routers.dataHandler import router as data_handler_router
app = FastAPI(
title="Breezeplan API",
version="1.0.0.v",
description="API for weather data and activity suggestions."
)
# Enable CORS Middleware
app.add_middleware(
CORSMiddleware,
allow_origins=["*"], # Allows all origins, change to specific frontend URL in production
allow_credentials=True,
allow_methods=["*"], # Allows all HTTP methods (GET, POST, etc.)
allow_headers=["*"], # Allows all headers
)
app.include_router(weather_router)
app.include_router(activity_suggestions_router)
app.include_router(data_handler_router)
@app.get("/", tags=["Root"])
async def read_root():
"""
Root endpoint for the Breezeplan API.
"""
return {"message": "Welcome to the Breezeplan API!"}