In directory /backend/
, copy .env_file_template
to .env_file
.
Keep your secret string in it.
You can generate a secret string by running this code in node.js:
require('crypto').randomBytes(48, function(err, buffer) {
var token = buffer.toString('hex');
console.log(token);
});
like this:
- Open a terminal and
git clone
this repositoryOr unzip our web application if you have the zip file
- If you install docker on Mac/Windows, then just go to Docker's official website and download and install docker, then start docker in your computer.
- If you install docker on Debian Squeeze
- Please follow the instructions here
- Note that make sure you have root priviledges to run commands.
- Note that we cannot get the root priviliedges in vlab, which means the
sudo
is not working, so we, sadly, cannot go through this step. So if there is an issue on installing docker in Debian system, you can try use mac/windows if possible. If not, please contact us for further help or other alternative ways at any time.
- Up to this step, the docker daemon should be up and listening for connections. If not, the following steps would not run successfully.
- Open a terminal and
cd
to the root directory of this project(same directory withdocker-compose.yml
)By default, the
backend/.env_file
file will be cloned together from the repository, but just in case that if there is no such file in the backend folder, just create one and copy and paste the following content in it:SW_JWT_SECRET = asdfdasfajsldfjdsjfjkljsfdjaklsdfjkladsjfklasdjflkjkljdakfjaldsfjlerioqueoirudgncn; MONGO_INITDB_ROOT_USERNAME = ROOT_USERNAME; MONGO_INITDB_ROOT_PASSWORD = ROOT_PASSWORD;
- Run
docker-compose up --build
to build and run this project - After everything is built and up, go to
http://localhost:3000
- Run
docker-compose up
in your terminal (make sure the docker is up in your computer, otherwise the docker command will not working) - Go to
http://localhost:3000
Due to the persist-login functionality in our system, a chrome profile can only persist a user's cookie from SW website. So it is better to create multiple profiles in chrome and run our website to avoid the situation that logging in one more user will kick out the current user.
Reason to have this multiple profiles to play around our web application is that our web application has all kinds of interaction between different roles.
Way to create profile in Chrome, click here
- After the system is up, type the following code to initiate dummy data
curl http://localhost:8000/dbinit
- This will generate hundreds of SW users and thousands of history order records which is enough for sales analysis in dashboard in the manager page
- All users information can be found in
dummyUsers.json
for the sake of login
- Please follow the video guide below to create your own mock-up data step by step
This way is to use our dummy data, so make sure you have populated our dummy data, then this QRcode will be valid and you can make order in Crig's Old Town HongKong Cusine restaurant.
To set this as an example, customer page can be accessed by scanning the QRcode which is generated by QR code Generator. Based on our configuration with docker, customer can enter into menu page by scanning QRcode with QR reader in the computer.
The following is the Crig's Old Town HongKong Cusine restaurant's QRcode, which contains information of tableid=10.
Another way is to type into URL directly. Steps are as follows.
Step 2 Enter the menu page. The toast is showing that the tableid is null.
Step 3 Type tableid in the URL and refresh. Until now, the tableid is set well and you are free to make an order.