This project demonstrates a balance of performance, scalability, and ease of use:
- Server side: NodeJS
- Efficient handling of concurrent requests
- Client-side: ReactJS
- Simplifies the development of dynamic and interactive user interfaces
- Database: MySQL
- Reliable and has widespread support for managing relational data
The front-end will be hosted on localhost 3000.
The back-end will be hosted on localhost 5000.
The default port for MySQL workbench should be 3306.
You may change ports and other credentials in the app code and database if necessary.
cd login-app- Open
server.jsin VS Code or an IDE of your choosing. - Lines 13, 18, and 27 have port numbers hardcoded. This is where you can change ports to fit your needs.
cd ..- Open
.envin VS Code or an IDE of your choosing. - You may change ports as well as other credentials here.
You can download NodeJs from this link: https://nodejs.org/en
You can also install NodeJs with this command in the terminal: sudo apt install node
To check the status of node: node -v
To check the status of npm: npm -v
-
Install nvm with this terminal command:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.5/install.sh | bash -
Run this after the nvm installation:
source ~/.bashrc -
To check the status of nvm:
nvm --version -
Set the default Node version:
nvm use node
Note: If you get an error, you may need to run this before the step above :
nvm install node
Note: This step may not be needed for the user to complete.
Navigate to the app location and use this line to install express:
npm install express mysql2 bcryptjs express-session body-parser
You can download MySQL from this link: https://dev.mysql.com/downloads/mysql/
You can also install MySQL with this command in the terminal:
sudo apt install mysql-client-core-8.0
To check the version of MySQL: mysql --version
To check the status of MySQL: mysql -u root -p
Linux status check: sudo service mysql status
-
Update packages:
sudo apt update -
Install MySQL server:
sudo apt install mysql-server
You may need to stop the server to prevent other issues/errors:
sudo service mysql stop
-
Change the home directory:
sudo usermod -d /var/lib/mysql mysql -
Give the correct permissions:
sudo mkdir -p /var/lib/mysqlsudo chown mysql:mysql /var/lib/mysql -
Start the server again:
sudo service mysql start -
Check the status:
sudo service mysql status
You can download MySQL workbench from this link: https://dev.mysql.com/downloads/workbench/
Run the MySQL Workbench program and open a connection. You will need to con
Download the app called login-app from the zip folder. Then, navigate to the folder that the app is in and start the app like this:
cd login-app
npm start
Here is a list of most of the relevant commands:
npm start
Starts the development server.
npm run build
Bundles the app into static files for production.
npm test
Starts the test runner.
Note: As a user of the app, you will likely not need to do this, so feel free to ignore the remaining part of this section.
If there are many deprecated packages, it is a good idea to update them.
Note: Make sure you are in the app folder for this.
-
Start with this:
npm update -
For major updates, install a global check:
npm install -g npm-check-updates -
Get all of the latest versions:
ncu -u -
Install all of the updates:
npm install
If there are still major vulnerabilities, you can also fix those:
-
Check for the issues:
npm audit -
Force an update:
npm audit fix --force
Note: Be cautious of the force command, as it could break the application.
Open MySQL Workbench. If you need to set up MySQL with the configurator, go ahead and do that with everything default.
Start the React app.
In VS Code or an IDE of your choice, use the terminal to navigate to the login-app location. Make sure you cd into the folder. Type npm-start to start the app. This should pull up the app in a browser.
Start the MySQL server.
In the terminal, use sudo /etc/init.d/mysql start to start the server. Use sudo /etc/init.d/mysql status to check the status and make sure it is running.
Then, open MySQL Workbench.
If the start server commands above did not work, you can open the server through the MySQL Workbench program. In the navigator (on the left side panel), there should be a section called INSTANCE. Click the option that says Startup / Shutdown to start the server.
If you are unable to start the MySQL Workbench connection, follow these steps for the Access Denied Error:
- In the terminal, run this:
sudo mysql -u root -p - Run this to find out what users are running:
SELECT user, host FROM mysql.user; - Use the following command to grant access to the users, but replace
'your_password'with the actual password you'd like to use for therootuser:
GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED BY 'your_password' WITH GRANT OPTION;
FLUSH PRIVILEGES;
Set up the MySQL server. Open MySQL Workbench if it is not open already and open