Notice: Undefined index: url in /var/www/html/wp-content/themes/orfeo/functions.php on line 432


Assignment Background

In this assignment, you will develop a server capable of serving the order form
resources from assignment #1. The server will also be responsible for tracking some
sales data for each restaurant and providing that sales data in HTML format when
requested. All order data that your server stores for this assignment may be stored in
RAM. That is, there is no need for persistence. If your server is restarted, it is
acceptable to start from an empty set of orders. The only external modules you may
use for this assignment are template engine modules (i.e., no Express.js, etc.).

You may use any available template engine you desire.

Before starting your design for the assignment, you are encouraged to read through the
entire specification. It is possible that later problems will inform your design decisions
and, by preparing in advance, you can avoid having to significantly refactor your code
as you progress through the assignment.

To begin this assignment, download the file from
Brightspace. This zip file contains a basic solution to assignment #1 (this will be added
to the zip file after the A1 deadline, you may use your own A1 solution if you want
to start this assignment earlier), as well as a restaurants directory containing three
.json files. Each of these files contains the restaurant data for one restaurant in JSON
format. Note that JSON within a file can be easily read into your Node.js server and
converted to a Javascript object using the require directive.

The first part of this assignment will involve serving resources like those created
for assignment #1. You may use your own assignment #1 solution (recommended
if it meets the requirements), start from the files provided in the zip after the
assignment #1 deadline, or write a new solution that meets the minimum
requirements listed in the problem description

Server Load (10 marks)

When your server loads, it must first read and store all relevant information contained in
the files within the restaurants directory. Your code should be written in such a way
that new files may be added to the directory containing additional restaurants’
information without requiring changes to your code. Your HTTP server should not start
until this initialization process has completed.

Home Page and Header (15 marks)

Your server must serve a home page in response to GET requests for the base URL “/”.

At minimum, this page is required to display a basic welcome message, though you are
free to add extra content. In addition, this page and all other pages within your
application must display a header containing links to the following resources:

  1. The home page
  2. The order form
  3. The restaurant stats page

EasyDue™ 支持PayPal, AliPay, WechatPay, Taobao等各种付款方式!

E-mail:  微信:easydue