Spaces:
Sleeping
Sleeping
Health Check Endpoint
Browse files
app.py
CHANGED
@@ -3,10 +3,22 @@ from io import BytesIO
|
|
3 |
import funciones, globales
|
4 |
from fastapi import FastAPI, Form
|
5 |
from fastapi import FastAPI, File, UploadFile
|
6 |
-
from fastapi.responses import StreamingResponse, FileResponse
|
7 |
|
8 |
app = FastAPI()
|
9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
@app.post("/echo-image/",
|
11 |
description="Test endpoint que recibe y regresa la misma imagen, para probar envío, recepción y problemas con api o red.",
|
12 |
summary="Summary"
|
|
|
3 |
import funciones, globales
|
4 |
from fastapi import FastAPI, Form
|
5 |
from fastapi import FastAPI, File, UploadFile
|
6 |
+
from fastapi.responses import StreamingResponse, FileResponse, JSONResponse
|
7 |
|
8 |
app = FastAPI()
|
9 |
|
10 |
+
# Nuevo endpoint para Health Check
|
11 |
+
@app.get("/health",
|
12 |
+
tags=["Health Check"],
|
13 |
+
description="Verifica el estado de salud de la API.",
|
14 |
+
summary="Health Check"
|
15 |
+
)
|
16 |
+
async def health_check():
|
17 |
+
"""
|
18 |
+
Este endpoint devuelve una respuesta 200 OK para indicar que la API está funcionando.
|
19 |
+
"""
|
20 |
+
return JSONResponse(content={"status": "ok"}, status_code=200)
|
21 |
+
|
22 |
@app.post("/echo-image/",
|
23 |
description="Test endpoint que recibe y regresa la misma imagen, para probar envío, recepción y problemas con api o red.",
|
24 |
summary="Summary"
|