feat: complete Python FastAPI starter
This commit is contained in:
@@ -0,0 +1,22 @@
|
|||||||
|
import os
|
||||||
|
import uvicorn
|
||||||
|
from datetime import datetime
|
||||||
|
from fastapi import FastAPI
|
||||||
|
|
||||||
|
app = FastAPI(title="Cosmos Orbit FastAPI Starter")
|
||||||
|
|
||||||
|
@app.get("/")
|
||||||
|
def read_root():
|
||||||
|
return {
|
||||||
|
"status": "online",
|
||||||
|
"app": "Cosmos Orbit — Python FastAPI Server",
|
||||||
|
"timestamp": datetime.utcnow().isoformat()
|
||||||
|
}
|
||||||
|
|
||||||
|
@app.get("/health")
|
||||||
|
def health():
|
||||||
|
return {"status": "healthy"}
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
port = int(os.environ.get("PORT", 8000))
|
||||||
|
uvicorn.run("main:app", host="0.0.0.0", port=port)
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
fastapi>=0.110.0
|
||||||
|
uvicorn>=0.28.0
|
||||||
Reference in New Issue
Block a user