Weather Api endpoint

This commit is contained in:
shadowik 2024-10-20 13:33:15 +04:00
parent 61eb44b8fa
commit 4f659b1149
5 changed files with 47 additions and 5 deletions

12
.idea/dataSources.xml Normal file
View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="DataSourceManagerImpl" format="xml" multifile-model="true">
<data-source source="LOCAL" name="Wind" uuid="401b0fa3-45f0-4ed2-9524-fd6acc19f73e">
<driver-ref>mariadb</driver-ref>
<synchronize>true</synchronize>
<jdbc-driver>org.mariadb.jdbc.Driver</jdbc-driver>
<jdbc-url>jdbc:mariadb://193.124.203.110:3306/wind_towers</jdbc-url>
<working-dir>$ProjectFileDir$</working-dir>
</data-source>
</component>
</project>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="JavaScriptLibraryMappings">
<file url="file://$PROJECT_DIR$" libraries="{@popperjs/core, bootstrap}" />
</component>
</project>

14
.idea/webResources.xml Normal file
View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="WebResourcesPaths">
<contentEntries>
<entry url="file://$PROJECT_DIR$">
<entryData>
<resourceRoots>
<path value="file://$PROJECT_DIR$/server/src/static" />
</resourceRoots>
</entryData>
</entry>
</contentEntries>
</component>
</project>

View File

@ -6,6 +6,7 @@ from fastapi.staticfiles import StaticFiles
from routers.floris_router import router as floris_router from routers.floris_router import router as floris_router
from routers.floris_template_router import router as floris_template_router from routers.floris_template_router import router as floris_template_router
from routers.weather_router import router as weather_router
app = FastAPI() app = FastAPI()
@ -15,8 +16,4 @@ app.mount("/public", StaticFiles(directory=Path("../public")), name="public")
app.include_router(floris_router) app.include_router(floris_router)
app.include_router(floris_template_router) app.include_router(floris_template_router)
app.include_router(weather_router)
# if __name__ == "__main__":
# import uvicorn
# uvicorn.run(app, host="localhost", port=8080) # Изменено на localhost

View File

@ -0,0 +1,13 @@
from fastapi import APIRouter
from data.repository import WeatherRepository
router = APIRouter(
prefix="/api/weather",
tags=["Weather Api"],
)
@router.get("/")
async def get_weather():
return WeatherRepository().get_all()