-
Download and Install MySQL:
- Download from MySQL.
- During installation, set the root password and remember it for later.
-
Download and Install Node.js:
- Download from Node.js.
-
Install
http-serverglobally (for serving client-side files):npm install -g http-server
-
Clone or Download the Project Files
Ensure you have the project folders (
server1for the client andserver2for the API server). -
MySQL Setup
- Open the MySQL command-line client:
mysql -u root -p
- Enter your root password and then create the
patients_dbdatabase:CREATE DATABASE patients_db; EXIT;
- In the
server2/db.jsfile, replace the following with your MySQL credentials:- User: Replace
'root'. - Password: Replace
'password'with your MySQL root password.
- User: Replace
- Open the MySQL command-line client:
-
Install Node.js Dependencies
In both
server1andserver2folders, run:npm install
Navigate to the server1 directory and start the client:
cd path/to/server1
http-server -c-1The client will be available at http://localhost:8080.
Navigate to the server2 directory and start the server:
cd path/to/server2
Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope Process # (Only needed on Windows)
node server.jsThe API server will be running at http://localhost:3000.
-
Insert Sample Patient Data:
- Open your browser and go to
http://localhost:8080. - Click "Insert Sample Patient Data" to add predefined patients to the database.
- Open your browser and go to
-
Run SQL Queries:
- Enter SQL queries (either
SELECTorINSERT) in the textarea and click "Submit Query" to run them against the database.
- Enter SQL queries (either
- Ensure that MySQL is running before starting the server.
- If you encounter PowerShell execution policy issues on Windows, use:
Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope Process
- Modify the MySQL credentials in
server2/db.jsas per your system setup (username, password, database). - Use the predefined queries or create your own
SELECTandINSERTstatements.