Server Side Rendering with Session and Cookies Handling - Lab Task 11

Last Updated On: July 30, 2020

Background

Modern web applications make extensive use of browser based libraries and frameworks e.g. REACT, Angular, Vue.js, etc. These apps are built on REST API i.e. final HTML code is generated at browser side, only data is sent and received from REST endpoints. Before these technologies and even today, in many web applications, complete web pages are generated at server side and sent to browsers where they are rendered and the output is displayed to user. OpenCart, Magento, Wordpress, OSCommerce, etc. which are very popular open source scripts for online stores, make use of server side rending (at least their inital versions). The objective of this task is to get hands on how server side rendered apps are built and different from REACT based apps.

Task Description

With reference to lecture 28, following is already implemented in code:
  1. Register, login and logout features
  2. Product CRUD
  3. Add and remove product in cart. and view cart
Extend that applications adding following:
  1. CRUD for category. Add and Update product category shall be accessable only if the user role attribute us admin.
  2. Update add new product such that user shall be able to choose a category to be linked with product. You may create a drop down list for category. This list should be driven by database.
  3. When new user is registered, set its role attribute to "user". By default, make one or more users' admin, by directly updating the record in DB, setting role to "admin".
  4. Update the cart, such that items added in cart shall store in session, and not in cookies. As we may need to manage cart at server side, because some users do not allow cookies to be added in browser.
  5. Some large ecommerce websites preserve the user cart even if user comes after days or months. that means, they save the user cart in datebase. If the user is logged in, and he/she add some products in cart, save cart items in mongodb when user logout. And when user login again, load user cart from mongodb, so that user could continue shopping where user left.
  6. Add another section in products page, show list of recently visited products in that section. You can use session or cookies for this.

Comments