Define an HTTP POST Endpoint for a Node.js Server with Swagger

Will Button
InstructorWill Button

Share this video with your friends

Send Tweet

In this lesson, you will learn how to define HTTP POST operations for your Todo API server using Swagger. Creating the endpoint, passing the todo in the request body, and parsing the todo are all demonstrated.

Raphi
Raphi
~ 4 years ago

You demonstrate how to send an object (i.e. a Todo) in a POST request, by using a schema and $ref to the definition.

How do you describe, in the YAML, just a simple string in the POST body, rather than a schema?

(Pardon me if you cover this in a later video)

Will Button
Will Buttoninstructor
~ 4 years ago

Hi Raphi, This should work for you:

      responses:
        '200':
          description: sample description
          schema:
            type: string