Pepguy commited on
Commit
06f8485
·
verified ·
1 Parent(s): 24855d1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -13
app.py CHANGED
@@ -4,16 +4,6 @@ app = FastAPI()
4
 
5
  @app.post("/")
6
  async def log_json(request: Request):
7
- try:
8
- # Parse the JSON body from the request
9
- json_body = await request.json()
10
- # Log the JSON payload to the console
11
- print("Received JSON payload:", json_body)
12
- # Respond with a success message
13
- return {"status": "success", "message": "JSON payload logged successfully"}
14
- except Exception as e:
15
- # Handle cases where the request body is not valid JSON
16
- print("Failed to parse JSON payload:", e)
17
- return {"status": "error", "message": "Invalid JSON payload"}, 400
18
- :contentReference[oaicite:2]{index=2}
19
-
 
4
 
5
  @app.post("/")
6
  async def log_json(request: Request):
7
+ data = await request.json()
8
+ print("Received JSON:", data)
9
+ return {"status": "success", "message": "Data received"}