The ability to reply to discussions is limited to PRO members. Want to join in the discussion? Click here to subscribe now.

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

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

1:23
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.
Watch this lesson now
Avatar
egghead.io

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.

Avatar
Raphi

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)

Avatar
Will

Hi Raphi,
This should work for you:

responses:
        '200':
          description: sample description
          schema:
            type: string
In reply to Raphi
HEY, QUICK QUESTION!
Joel's Head
Why are we asking?