Agrego guia, reportes y alertas con menu de navegacion
This commit is contained in:
29
main.py
Normal file
29
main.py
Normal file
@@ -0,0 +1,29 @@
|
||||
from fastapi import FastAPI, Request
|
||||
from fastapi.responses import HTMLResponse
|
||||
from datetime import datetime
|
||||
|
||||
app = FastAPI()
|
||||
|
||||
reportes = []
|
||||
|
||||
@app.get("/guia", response_class=HTMLResponse)
|
||||
def guia_separacion():
|
||||
with open("guia.html", "r", encoding="utf-8") as f:
|
||||
return f.read()
|
||||
|
||||
@app.get("/reportes", response_class=HTMLResponse)
|
||||
def pagina_reportes():
|
||||
with open("reportes.html", "r", encoding="utf-8") as f:
|
||||
return f.read()
|
||||
|
||||
@app.get("/alertas", response_class=HTMLResponse)
|
||||
def pagina_alertas():
|
||||
with open("alertas.html", "r", encoding="utf-8") as f:
|
||||
return f.read()
|
||||
|
||||
@app.post("/api/reportes")
|
||||
async def recibir_reporte(request: Request):
|
||||
datos = await request.json()
|
||||
datos["fecha"] = datetime.now().strftime("%d/%m/%Y %H:%M")
|
||||
reportes.append(datos)
|
||||
return {"mensaje": "Reporte recibido correctamente", "total": len(reportes)}
|
||||
Reference in New Issue
Block a user