Skip to content

Instantly share code, notes, and snippets.

@mrtushartiwari
Created February 11, 2023 05:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mrtushartiwari/01270097df93da80e895555e5cc3b0fb to your computer and use it in GitHub Desktop.
Save mrtushartiwari/01270097df93da80e895555e5cc3b0fb to your computer and use it in GitHub Desktop.
FastAPI post request for intercommunication
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