Node/expressjs backend with react frontend. The sites checkout is fully integerated with paypal payments. Only the webhook listener needs to be done for updating the db after purchase.
- Install nodejs and npm (nodes package manager) on Ubuntu:
root@server:~$ curl -sL https://deb.nodesource.com/setup_11.x | sudo -E bash -
root@server:~$ sudo apt-get install -y nodejs
Note: If node was installed using
apt (ie: sudo apt install nodejs)
then you must also runsudo apt install npm
to installnpm
. Also ifapt
was used the installed executable will be callednodejs
instead ofnode
. The command to run the server would becomenodejs app
rather thannode app
- Configure and install mysql (This step will create your mysql user)
root@server:~$ sudo apt install mysql-server
root@server:~$ mysql_secure_installation
- Import Mysql database schema (Replace username with database user: for security purposes avoid using root)
root@server:~$ mysql -u <user-name> -p
Enter password:
Welcome to MySQL monitor....
mysql> CREATE DATABASE <database-name>;
mysql> copy & past the schema.sql file here
Note: If you already have the database created use
mysql -u root -p <db-name> < server/models/schema.sql
- Install all the dependencies
root@server:~$ cd client && npm install
root@server:~$ cd server && npm install
- Edit the
server/models/connection_template.js
file and update the host/port/user/password & change its name.
root@server:~$ vi server/models/connection_template.js
root@server:~$ mv server/models/connection_template.js server/model/connection.js
- Edit the
server/middlewares/helper/paypal_settings_template.js
file and update the CLEINT-ID/SEED & change its name.
root@server:~$ vi server/middlewares/helper/paypal_settings_template.js
root@server:~$ mv server/middlewares/helper/paypal_settings_template.js server/middlewares/helper/paypal_settings.js
root@server:~$ cd client && npm start
root@server:~$ cd server && node app
For the total Javascript project line run the count_lines binary (Ubuntu). ./count_lines > line_count
- Routes: Folder contains all the app routes.
- Middlewares: Folder contains all logic for handling various requests on the routes
- Models: Folder contains all of the sql queries
The client was stitched together for display purposes. Has a lot of refactoring and reorganization that needs to be done. All the react components are found in src/. The structure here is very messy.