Created
February 11, 2023 05:13
-
-
Save mrtushartiwari/01270097df93da80e895555e5cc3b0fb to your computer and use it in GitHub Desktop.
FastAPI post request for intercommunication
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from fastapi import FastAPI | |
from pydantic import BaseModel | |
app = FastAPI() | |
class Fullname(BaseModel): | |
first_name: str | |
last_name : str | |
@app.post("/coolname") | |
async def name_cool(fullname: Fullname): | |
return f"You got a cool name {fullname.first_name} {fullname.last_name}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment