File size: 409 Bytes
2e9b0fa |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
from fastapi import Request, FastAPI
from fastapi.staticfiles import StaticFiles
app = FastAPI()
# TODO: hide your API key as a space's SECRET, access it via environment variable
@app.post("/api/test")
async def api_test(request: Request):
return {
"message": "This is a test",
"what_you_sent": await request.json(),
}
app.mount("/", StaticFiles(directory="static", html=True), name="static")
|