refactor(weather.app): move routes to weather.app module
This commit is contained in:
13
weather/app/route/api.py
Normal file
13
weather/app/route/api.py
Normal 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)
|
||||
Reference in New Issue
Block a user