MangoDB代写|COMP 2406 Assignment 4 MongoDB and Sessions


Assignment Background

In this assignment, you will use a database to store user profile and order information.

Additionally, you will add session support to the application so that users may log in,
place orders, and view a history of their orders. Users will also have the option of setting
their own profile to private/public, which will limit who can view their order history. You
MUST use MongoDB to store the user profile, order data, and session data for
this assignment. You may choose to use the MongoDB module or Mongoose for
database manipulation within Node.js.

To start this assignment, download the file from Brightspace. This zip file
contains several resources that will be used for the assignment. The first of these
resources is the database-initializer.js file, which you can use to create the initial
database for the assignment (or re-create it if you break the database during testing).

Initialize your project using npm init. Ensure the MongoDB Node.js driver is installed
in your assignment directory by running npm install mongodb. Run the database
initializer.js file using Node.js while the MongoDB daemon is also running on your
computer, and it will initialize a database called ‘a4’ with a collection called ‘users’
containing ten initial user profiles for your server. Each user document contains a
username, a password (which is the same as the username, for convenience), and a
privacy field that will initially be set to false. You may modify the provided database
initializer.js file to perform any additional initialization your server requires. If you
do modify the file, ensure that you include a copy with your assignment submission.

The file also contains a public folder with order form resources. This
includes a working orderform.html and orderform.js file that will allow a client to
select a restaurant and submit an order to the server using an XMLHttpRequest. Note
that you may need to modify the order form resources, or create a similar version using
a template engine, to meet the navigation header requirements of the assignment. You
may use your own version of similar resources, if desired. For this assignment, it is
acceptable to store the data for the three restaurants in the client-side Javascript.

However, you can also choose to serve the restaurant data from the server, as was
done in the previous assignment.

Navigation Header (12 marks)

Each page on your web application should have a navigation header. The information
contained in this header will vary depending on the current session state of the client.

If the client is logged in as a user of the application, the header must include links to the
home page (/), the users page (/users), the order form, and the user’s profile.

Additionally, the header should provide a way for the user to log out of the application
(e.g., a link or button).

If the client is not logged in, the header must include links to the home page (/), the
users page (/users), and the registration page. The header must also include a way for
the user to log in to the application (e.g., a login form in the header, or a link to a login
page). The link to the order page should NOT be shown unless the client is logged in.


本网站支持淘宝 支付宝 微信支付  paypal等等交易。如果不放心可以用淘宝交易!

E-mail:  微信:itcsdx