FastAPI - in memory counter



examples/fastapi/counter-in-memory/main.py
from fastapi import FastAPI

app = FastAPI()

counter = 0

@app.get("/")
async def main():
    global counter
    counter += 1
    return {"cnt": counter}