19 lines
325 B
Python
19 lines
325 B
Python
from fastapi import FastAPI
|
|
|
|
app = FastAPI()
|
|
|
|
count = 0
|
|
|
|
@app.get("/count")
|
|
async def get_count():
|
|
global count
|
|
count += 1
|
|
return {"count": count}
|
|
|
|
@app.get("/")
|
|
async def root():
|
|
return {"message": "Hello World"}
|
|
if __name__ == "__main__":
|
|
import uvicorn
|
|
uvicorn.run(app, host="0.0.0.0", port=12345)
|