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.
Resources for this lesson are accessible to you in this repository
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.
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.
Purpose: Create and publish API documentation.
Task: Complete the assignment.
By the end of this assignment the student will be able to do the following:
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:
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.
Criteria | Weight | Mastery | Proficient | Developing | Beginning | Missing/Incomplete |
---|---|---|---|---|---|---|
100% | 90% | 78% | 65% | 0% | ||
HTTP Requests(Graded via YouTube) | 25% | Meets Proficient criteria and performs PUT request. MongoDB is updated | Meets Developing criteria and performs POST and DELETE requests. MongoDB is updated | Meets Beginning criteria and performs GET requests from MongoDB | Node project has evidence of http requests | GitHub 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 routes | Meets Developing criteria and the route: "/api-docs" is accessible and is able to test the endpoints | Meets Beginning criteria and the following routes are present in the swagger.json: GET all, GET by id, PUT, POST, and DELETE | Node project contains a swagger.json file with some content in it relevant to the "contacts" project | No 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 errors | Render project has been created | Render 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 birthday | Meets Developing criteria and the contacts collection has at least five contacts | Meets Beginning criteria and MongoDB has a collection called "contacts" | MongoDB account exists and was demonstrated in the video | No 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 Render | Meets Developing criteria plus each route calls a function imported from a controller | Meets Beginning criteria plus server connects to routes in project "routes" folder using only a single line of code | Server file is present in root folder (server.js, index.js or app.js) to run the Node project | Render link not submitted |
| 10% | Meets Developing criteria and the backend PUT works on the frontend and the data change shows in MongoDB | Meets Developing criteria and the backend POST works on the frontend and the data change shows in MongoDB | Meets Beginning criteria and the backend DELETE works on the frontend and the data change shows in MongoDB | The backend GET works on the frontend | No attempt made or nothing works |