Lesson 4: API Documentation

  Overview

Introduction

Welcome to lesson four! The focus of this lesson is API Documentation. We will learn about modern tools to help us design, document, test, and manage our APIs. You will also submit your first project of the semester.

Topics for this lesson:

  • API Documentation
  • Popular API Tools
Have Feedback?

  Learning Material

Resources for this lesson are accessible to you in this repository

The following learning material may be helpful but is not required. Please reference the syllabus for more details.

Be aware that there are other resources for doing very similar types of API documentation. None of them appear to be as widely integrated with npm or as widely used in industry. Two other popular ones are Postman (which started off as just a rest client), and Readme. We will only use Swagger in this course.

  Team Assignment

Overview

Purpose: Add documentation to an API
Task: Complete the assignment

For this team activity, your group will be given a Node.js project similar to the one you've been working on and add API documentation to it.


  Personal Assignment

Overview

Purpose: Create and publish API documentation.
Task: Complete the assignment.

Learning Objectives

By the end of this assignment the student will be able to do the following:

Assignment Description

In previous lessons you have written RESTful API routes in Node.js that connect the outside world to a MongoDB database. For this lesson, you will finish your Contacts project. To conclude, you will document your API using Swagger. Below are the steps to complete this task:

Full Stack Project Overview

In an effort to help you see how a backend project works within a fullstack project, this React Application was created to work with your Contacts project. It performs all of the api requests/routes that are in your application but with a GUI instead of swagger, or another rest client. As a stretch challenge, try to test your published api with this website. The video below goes into more detail about this, and about 1 extra thing that you'll need to add to your backend api in order for this to work.

Rubric

CriteriaWeightMasteryProficientDevelopingBeginningMissing/Incomplete
100%90%78%65%0%
HTTP Requests

(Graded via YouTube)
25%Meets Proficient criteria and performs PUT request. MongoDB is updatedMeets Developing criteria and performs POST and DELETE requests. MongoDB is updatedMeets Beginning criteria and performs GET requests from MongoDBNode project has evidence of http requestsGitHub link, or YouTube link not submitted. Or no evidence of HTTP requests
API Documentation

(Graded via YouTube)
25%Meets Proficient criteria and the swagger.json contains a contact schema that is used in all of the routesMeets Developing criteria and the route: "/api-docs" is accessible and is able to test the endpointsMeets Beginning criteria and the following routes are present in the swagger.json: GET all, GET by id, PUT, POST, and DELETENode project contains a swagger.json file with some content in it relevant to the "contacts" projectNo API documentation present (no swagger.json or "api-docs" route in project for swagger)
Deployment

(Graded via YouTube)
25%Meets Proficient criteria and uses Render Config Vars (no database credentials stored in GitHub - must show GitHub repo in video)Meets Developing criteria and video shows project functionality using Render (not localhost)Meets Beginning criteria, project is deployed to Render and Render shows no errorsRender project has been createdRender link, GitHub link, or YouTube link not submitted
Database

(Graded via YouTube)
15%Meets Proficient criteria and the contacts in the database have the following fields: firstName, lastName, email, favoriteColor, and birthdayMeets Developing criteria and the contacts collection has at least five contactsMeets Beginning criteria and MongoDB has a collection called "contacts"MongoDB account exists and was demonstrated in the videoNo evidence of database present or no YouTube link
Architecture

(Graded via GitHub)
10%Meets Proficient criteria plus includes a .rest file with routes for localhost and RenderMeets Developing criteria plus each route calls a function imported from a controllerMeets Beginning criteria plus server connects to routes in project "routes" folder using only a single line of codeServer file is present in root folder (server.js, index.js or app.js) to run the Node projectRender link not submitted
Extra Credit
Frontend Integration

(Graded via YouTube)
10%Meets Developing criteria and the backend PUT works on the frontend and the data change shows in MongoDBMeets Developing criteria and the backend POST works on the frontend and the data change shows in MongoDBMeets Beginning criteria and the backend DELETE works on the frontend and the data change shows in MongoDBThe backend GET works on the frontendNo attempt made or nothing works