Improve your FastAPI app by creating a new POST endpoint /echo that accepts a JSON object with a message field, and returns the same message back. Use a Pydantic model for input validation. Return an error if the message is missing or not a string.
Steps:
- Create a Pydantic model for input data.
- Add POST
/echo endpoint using that model.
- Return input as JSON or an error message for invalid input.
Label this issue as 'good first issue'.
Improve your FastAPI app by creating a new POST endpoint
/echothat accepts a JSON object with amessagefield, and returns the same message back. Use a Pydantic model for input validation. Return an error if the message is missing or not a string.Steps:
/echoendpoint using that model.Label this issue as 'good first issue'.