LapStore commited on
Commit
67c10a3
·
1 Parent(s): 1dc9545

Add application file

Browse files
Files changed (1) hide show
  1. app.py +8 -2
app.py CHANGED
@@ -1,7 +1,13 @@
1
- from fastapi import FastAPI
2
 
3
  app = FastAPI()
4
 
5
  @app.get("/")
6
  def greet_json():
7
- return {"Hello": "World!"}
 
 
 
 
 
 
 
1
+ from fastapi import FastAPI ,Request
2
 
3
  app = FastAPI()
4
 
5
  @app.get("/")
6
  def greet_json():
7
+ return {"Hello": "World!"}
8
+
9
+ @app.post("/")
10
+ def greet_json(request: Request):
11
+ data = request.json() # Get the JSON body of the request
12
+ name = data.get("name", "World") # Extract "name" from the request
13
+ return {"Hello": name}