Skip to content

Netherquark/Hospital-Management-System

Repository files navigation

Dependencies

wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash
source ~/.bashrc
nvm install --lts
node -v
npm -v
npm install -g react-devtools

not sure if you can use Vite/Bootstrap/MySQL2 that's already in the repo, let's see.

Steps to get started

  1. Clone this repo
  2. cd appropriately and then:
    • Terminal 1:
      node server.js
      
    • Terminal 2:
      npm run dev

Steps to Replicate

Front-end

  1. Create a new Vite project with React template:

    npm create vite@latest hms-website --template react
  2. Change directory to the project folder:

    cd hms-website
  3. Install project dependencies:

    npm install
  4. Install Bootstrap:

    npm install bootstrap
  5. Add Bootstrap CSS to your project. Open hms-website/src/main.jsx and add the following line:

    import 'bootstrap/dist/css/bootstrap.min.css';

Back-end

  1. Navigate back to the root directory:

    cd ..
  2. Create a new server directory and change to it:

    mkdir server
    cd server
  3. Initialize a new Node.js project:

    npm init -y
  4. Install required packages:

    npm install express mysql2
  5. Create a server file and add the following code to server/server.js:

    const express = require('express');
    const app = express();
    const PORT = process.env.PORT || 5000;
    
    // Middleware
    app.use(express.json());
    
    // Example route
    app.get('/', (req, res) => {
        res.send('Hello from the server!');
    });
    
    app.listen(PORT, () => {
        console.log(`Server is running on http://localhost:${PORT}`);
    });

Reference Code for MySQL Connection

Add the following code for MySQL connection in your server file:

const mysql = require('mysql2');

const db = mysql.createConnection({
    host: 'localhost',
    user: 'your_username',
    password: 'your_password',
    database: 'your_database'
});

db.connect((err) => {
    if (err) throw err;
    console.log('Connected to MySQL Database!');
});

To Run the Application

  • Terminal 1: Start your server.
  • Terminal 2: Run the front-end:
    npm run dev

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors