You are on page 1of 1

Database Connectivity Assignment 3:

Part 1: In-Class Tasks


You must complete these three tasks IN-CLASS on the specified day. The professor will release a
document containing the task during the lecture. If you are not in class, you will get 0 for that task.
There is no drop-box for the tasks, so you must show the professor your work before you leave.

Task 7: Connecting the API to the Database


Task 8: Displaying Data in the View
Task 9: Adding New Data with a Form

Part 2: Main Component


The end goal of this assignment is that you have a working site which does the following: displays a list
of every item in your database, and when clicking an item it takes you to the details page containing all
of the extra information. We also want to have a page which allows a user to create a new entry and
get that POSTed and written to the database.

1. Continue working on the project you created for the previous assignment
2. Open the APP_API/controllers/ folder and modify all the CRUD placeholder functions so
they interact with the database now. You should be able to perform the following tasks
with the database: get a single item, get all items, delete an item, update an item,
create an item. You can test if they work using Postman.
3. Open the APP_SERVER/controllers folder and modify the controller so that it gets
responses from the API and renders the correct pages. You will need to at least render/
get responses for a list, a details page (which displays data from a single item), and a
create page.
NOTE:
a. "Request" needs to be installed and referenced in the controller
(see Section 7.1.1)
b. The "apiOptions" also needs to be added to the controller
(see Section 7.1.2)
4. Open the APP_SERVER/views folder and modify list.pug so it displays the names of the
entire list of data and allows you to click each one taking you to its details page.
5. Create a details.pug which displays all the fields of a single item and a create.pug which
contains a form that allows you to create a new item.
NOTE: Don't forget to add the Create page to your nav.
6. Edit the APP_SERVER/routes/index.js file to add routes for the following: a page for the
item id, which maps to the controller that displays the details page and a /new route
for creating a new entry.
7. Improve the design of the new pages you created (the form and the details).

Please refer to the Assignment Rubric for a breakdown of the marking for this Assignment.

You might also like