mirror of
https://github.com/michivonah/bbzw-horizon.git
synced 2025-12-22 17:16:27 +01:00
implement https & healtcheck endpoint
This commit is contained in:
parent
d629882c32
commit
a7594df5cf
3 changed files with 11 additions and 4 deletions
|
|
@ -15,7 +15,7 @@ CREATE TABLE "sensor_data"(
|
|||
id INTEGER GENERATED BY DEFAULT AS IDENTITY,
|
||||
timestamp TIMESTAMP,
|
||||
humidity DECIMAL(5,3),
|
||||
pressure DECIMAL(5,3),
|
||||
pressure DECIMAL(7,3),
|
||||
temperature DECIMAL(5,3),
|
||||
voc DECIMAL(5,3),
|
||||
gas DECIMAL(5,3),
|
||||
|
|
|
|||
|
|
@ -23,6 +23,8 @@ COPY webservice.py .
|
|||
COPY crypto.py .
|
||||
COPY dbfunctions.py .
|
||||
COPY models.py .
|
||||
COPY certs/key.pem .
|
||||
COPY certs/cert.pem .
|
||||
|
||||
# Start app
|
||||
CMD ["uvicorn", "webservice:app", "--host", "0.0.0.0", "--port", "8080"]
|
||||
CMD ["uvicorn", "webservice:app", "--host", "0.0.0.0", "--port", "8080", "--ssl-keyfile=key.pem", "--ssl-certfile=cert.pem"]
|
||||
|
|
@ -14,7 +14,7 @@ app = FastAPI(
|
|||
title="BBZW-Horizon",
|
||||
description="BBZW-Horizon ist ein Tool, welches entwickelt wurde, um durch die Erfassung und Auswertung von Luftqualitätsmesswerten die Luftqualität in den Schulzimmern des BBZW Sursee zu verbessern. Bei dieser API handelt es sich um die Kommunikationsschnittstelle, zwischen den Arduinos, welche mit Sensoren die Daten erfassen und an die API senden. Diese API speichert die Daten dann in der Datenbank, damit diese durch das Frontend abgerufen und visualisiert werden können.",
|
||||
summary="Die BBZW-Horizon API dient als Kommunikationsschnittstelle, um Luftqualitätsmesswerte von Arduinos, die mit Sensoren ausgestattet sind, zu erfassen",
|
||||
version="0.0.3"
|
||||
version="0.0.4"
|
||||
)
|
||||
|
||||
# DB Session
|
||||
|
|
@ -113,4 +113,9 @@ async def get_recent_sensor_data_endpoint(
|
|||
if not recent_data:
|
||||
raise HTTPException(status_code=404, detail="No sensor data found in the specified time range.")
|
||||
|
||||
return recent_data # Rückgabe als JSON
|
||||
return recent_data # Rückgabe als JSON
|
||||
|
||||
@app.get("/health", response_model=MessageOnly, tags=["health"])
|
||||
async def health_check():
|
||||
"""Einfacher Healthcheck-Endpoint, der 'OK' zurückgibt."""
|
||||
return MessageOnly(message="OK")
|
||||
Loading…
Add table
Add a link
Reference in a new issue