Website REST ServiceFor Project 4 you created a list of tables to control the website. You were required to implement three of those tables
with properties, and two of the tables were required to have a relationship. You were also required to implement five
queries.
For Lab 6, you were required to duplicate code to create a working REST service using Node JS for the COLOR database
table.
For this project, you will combine the efforts of Project 4 and Lab 6 and create a REST service for ONE of your Project 4
tables. Below are the required elements.
1. Do NOT use a table with a JOIN to avoid complicated queries
2. Copy the Lab 6 server-color.js file and name the new file p5-server.js
3. Update the GET, POST, DELETE and PUT routes in p5-server.js to work with your table
4. Remove ALL references to color in p5-server.js, and update with references to your new tables
5. Optional: You can optionally remove any routes used to load web page content (e.g. the HTML, CSS and JS files).
6. Test your REST routes using Postman, and document the following information in p5-server-postman.txt
a. GET
i. The GET URL to retrieve ALL rows from your table
ii. The JSON result from Postman for all your rows
iii. The GET URL to retrieve the first row by primary key from your table
iv. The JSON result from Postman for your first row
b. POST
i. The POST URL to insert a new row into your table
ii. The JSON sent in Postman
iii. The JSON result from Postman from POST action
c. Optional: PUT and DELETE
i. Use Postman to perform DELETE and PUT actions
Below are two useful tutorials on using Postman:
⚫ Postman Tutorial For Beginners with API Testing Example >
⚫ Postman Tutorial For Beginners to perform API Testing >
Note: You may want to open the Postman Console while performing the REST actions to view the REST communication with
your NodeJS server.
Deliverables
You will need to collect all of the files for this project, and create a single compressed/ZIP folder called p5.zip thatOverview
This project is additional requirements given to Project 5. Submit Project 5 and Project 6 separately.
For Project 6, you will create two SQL views, and one stored procedure, using your Project 5 files. You will also update
your NodeJS code to execute one of the views, and use the stored procedures. The specifics are below.
SQL Views
Create two SQL views that work with your Project 5 alumni database. Both of your views must start with the vw_
prefix.
View #1: Create a simple view that returns data from one of your tables. Your view MUST include at least a single
calculated column (e.g. a column that does not exist within any of your tables, but is within the view and is calculated
from some part of your data). Export the SQL to create this view to a file called view1.sql.
View #2: Create a view that returns data from two tables using a JOIN statement. Export the SQL to create this view to
a file called view2.sql.
Add a new GET route to your NodeJS code to use the second view (the view with the JOIN statement). Remember you
will have to ensure the new route is not the same as any other GET route.
Stored Procedure
Create a stored procedure that deletes a row from one of your tables. The stored procedure must take an appropriate
primary key parameter to determine which row to delete. The stored procedure name must start with the sp_prefix.
Export the SQL to create this stored procedure to a file called sp.sql.
Add a new DELETE route to your NodeJS code to use the stored procedure to delete a row. You will need to adjust your
SQL to call the stored procedure, and supply the primary key as an argument to the stored procedure. Remember you
will have to ensure the new route is not the same as any other DELETE route.
Deliverables
You will need to collect all of the files for this project, and create a single compressed/ZIP folder called p6.zip that
contains all project files. Upload this single file to Canvas.