20 lines
365 B
Python
20 lines
365 B
Python
from fastapi import FastAPI, Request
|
|
import uvicorn
|
|
|
|
app = FastAPI()
|
|
|
|
|
|
@app.get("/")
|
|
def read_root():
|
|
return {"message": "Server is running!"}
|
|
|
|
|
|
@app.post("/")
|
|
async def receive_data(request: Request):
|
|
data = await request.json()
|
|
print(data)
|
|
return {"received_data": data}
|
|
|
|
if __name__ == "__main__":
|
|
uvicorn.run(app, host="0.0.0.0", port=8000)
|