refactor(weather.app): move routes to weather.app module

This commit is contained in:
2024-07-29 00:50:25 +03:00
parent 1fb627110d
commit 22fab7a15a
17 changed files with 31 additions and 9 deletions

13
weather/app/route/api.py Normal file
View File

@@ -0,0 +1,13 @@
import datetime
from fastapi import FastAPI, Request
from weather.model import WeatherResponse
def mount(app: FastAPI):
@app.get("/api/weather/{location}/{date}")
async def get_weather_api(
request: Request, location: str, date: datetime.date
) -> WeatherResponse:
return await request.app.state.weather_api.get_day(location, date)