FoodSloth is a proof-of-concept food delivery web application written as part of CS2102 Database Systems at the National University of Singapore.
It uses Node.js and Pug for its frontend, and Node.js with Express for its backend. It uses PostgreSQL for its database.
It is written with a primary focus on demonstrating the capabilities of PostgreSQL. As such, data validation and logical checks that would usually be integrated in code have been adapted to run as SQL triggers instead.
git clone https://github.com/dawo5010/cs2102.git
to clone the reponpm install
to install relevant node modulesnpm install nodemon
to install nodemon- Execute by running
nodemon app.js
- Website is available on localhost:8000
note: the website is not available unlessnodemon app.js
is executing
- Navigate to the backend folder
- Duplicate the
settings_blank.js
file - Rename the duplicated file to
settings.js
- Fill in your SQL database login details in
settings.js
npm install
to install the relevant node modulesnpm install sql-template-strings
npm install nodemon
to install nodemon- Start server with
nodemon index.js
- Backend is available at localhost:8001
- Ensure that PostgreSQL is installed
- Navigate to backend folder
- Run the command:
psql postgres
- CREATE DATABASE project;
- Run the command:
\c project
- Create tables using
sql/tables.sql
- [OPTIONAL] Insert default values for each table according to the numerical order specified in the filenames of each sql file in the
sql
folder - Follow step 2 - 4 of the Backend setup
- Run command:
npm i express pg
to install Express for the server and node-postgres (pg) to be able to connect to PostgreSQL - Run command:
node index.js
, list of all users in json format available on http://localhost:8001/users