A fuel delivery web application created that calculates the price of fuel based on the amount of fuel requested, the client's location, history and the company's profit margin.
- Frontend: ReactJS
- Backend: ExpressJS
- Database: SQL
- Libraries:
- Styling: Bootstrap
- Testing: Jest and React Testing Library
-
Clone this repository:
git clone https://github.com/Software-DesignX/COSC4353_Group7.git -
Install Git, Visual Studio Code, NodeJS
-
Install MySQL to your liking, and execute the script
backend/db/schema.sqlto initialize the database using the MySQL Workbench or command line tools as below:
In Windows, install MySQL using the installer and setup a password for the root user, and then perform the following on the machine hosting the database:
cd backend\db
mysql -h <HOSTNAME> -u root -p <PASSWORD> < schema.sql
Here HOSTNAME represents the machine hostname that the MySQL server is running on.
In macOS or Linux, install from your favorite package manager or using the community installer for your appropriate macOS and then perform the following on the machine hosting the database:
cd backend/db
mysql -h <HOSTNAME> -u root -p <PASSWORD> < schema.sql
- Configure the backend to connect to your database by modifying the
backend/.envfile:
MYSQL_HOST=127.0.0.1
MYSQL_PORT=3306
MYSQL_USER=app
MYSQL_PASSWORD=test_password
MYSQL_DB=cosc4353app
By default, the script will install to the database cosc4353app and create a user app with test_password. Replace MYSQL_HOST and MYSQL_PORT appropriately for your MySQL install
- Install the NPM package dependencies for the frontend and backend:
cd frontend
npm i
cd ../backend
npm i
- Installation of nodemon: required for running the backend Node.js daemon
npm install -g nodemon
Now we can test the frontend and backend separately, or run them in development mode together. Make sure that the MySQL database is running and accepting connections before starting the backend in development or production.
Testing mode:
- Start backend or frontend in testing mode:
cd frontend
npm test
We can generate code coverage reports using IstanbulJS and jest:
npm test -- --coverage
An HTML version of the code coverage report will be generated at ./coverage/lcov-report/index.html.
Development mode:
- Start backend, it will automatically begin listening on
localhost:3001:
cd backend
npm start
- In a separate terminal, start frontend, it will automatically begin listening on
localhost:3000and open a browser tab:
cd frontend
npm start


