Web and Mobile Development: Swagger (100 Points)

Assignment Goals

The goals of this assignment are:
  1. To document web services in node.js using Swagger

The Assignment

If (and only if) you are using GitHub to submit, you can clone this assignment from GitHub Classroom at https://classroom.github.com/a/OgaLKaBL. Otherwise, you may skip this step!

In this lab, you will document a web service using Swagger.

You can add a Swagger renderer to your web service via:

const swaggerUi = require("swagger-ui-express");

You can then document your data schema using a JSON structure:

const swaggerDocument = <JSON HERE>

You can get an example JSON structure by going here, and exporting the structure that you find to a JSON file (under the File menu at the website).

You can instantiate a path to your Swagger document as follows, which you can access at your usual URL with /api/doc appended to the end (as configured below):

app.use('/api/doc', swaggerUi.serve, swaggerUi.setup(swaggerDocument));

You can even document your authentication paths, such as OAuth! See here for additional description of documentation structures supported by Swagger.

Note that you will need to enable CORS to try out the endpoints!

Here is a minimal working example:

Part 1: Adding Swagger Documentation

Add Swagger documentation to one of your assignments or labs, and take a screenshot of the /api/doc page that is served when you run the project.

Submission

If you wrote code as part of this assignment, please include a README in which you describe your design, approach, and implementation. Additionally, please answer any questions from the assignment, and include answers to the following questions:
  • If collaboration with a buddy was permitted, did you work with a buddy on this assignment? If so, who?
  • Approximately how many hours it took you to finish this assignment (I will not judge you for this at all...I am simply using it to gauge if the assignments are too easy or hard)?
  • Your overall impression of the assignment. Did you love it, hate it, or were you neutral? One word answers are fine, but if you have any suggestions for the future let me know.
  • Any other concerns that you have. For instance, if you have a bug that you were unable to solve but you made progress, write that here. The more you articulate the problem the more partial credit you will receive (it is fine to leave this blank).

Assignment Rubric

Description Pre-Emerging (< 50%) Beginning (50%) Progressing (85%) Proficient (100%)
Code Quality and Documentation (90%) Code commenting and structure are absent, or code structure departs significantly from best practice, and/or the code departs significantly from the style guide Code commenting and structure is limited in ways that reduce the readability of the program, and/or there are minor departures from the style guide Code documentation is present that re-states the explicit code definitions, and/or code is written that mostly adheres to the style guide Code is documented at non-trivial points in a manner that enhances the readability of the program, and code is written according to the style guide
Writeup and Submission (10%) An incomplete submission is provided The program is submitted, but not according to the directions in one or more ways (for example, because it is lacking a readme writeup) The program is submitted according to the directions with a minor omission or correction needed The program is submitted according to the directions, including a readme writeup describing the solution