Docsity

Lab 7 Cloud Computing, Lab Reports of Computer Science

Toggle sidebar
bg1
The first thing I do this workshop, I must download package express-session to use Session.
User.ejs
In this file, I view table for user login.
Index.js
In file Index.js I ceate route login to access modifier for user, If user page will render to user page.
Contract, if user with role director, the page will render to admin page. Else, render to login page and
send a message: “wrong user password”.
pf3
pf4
pf5

Partial preview of the text

Download Lab 7 Cloud Computing and more Lab Reports Computer Science in PDF only on Docsity!

The first thing I do this workshop, I must download package express-session to use Session.

User.ejs

In this file, I view table for user login.

Index.js

In file Index.js I ceate route login to access modifier for user, If user page will render to user page. Contract, if user with role director, the page will render to admin page. Else, render to login page and send a message: “wrong user password”.

User.js

In this file, I create a route to get home page if users login, the page will render to users page and display product with shop_id. Next, I create a route post to req crud page to implement CRUD function. And display table after I implement function.

Crud.js

In this file, I implement each function includes: UPDATE, DELETE, INSERT how to use query product.

The result when I run program.

When I login with role user and try click on Delete button.

Before delete

After delete

When I click on Update button and change information includes name, price, quantity, shop_id with Id

Update:

When I click on Insert button and Add information includes id, name, price, quantity, shop_id.

The product with Id 19 created as image below: