Welcome to the Psychiatrist Platform project! This platform provides APIs for managing patients, hospitals, and psychiatrists. Below are the details of libraries/frameworks used and API endpoints.
- Clone the repository
git clone https://github.com/Winkingroad/psychiatrists-service.git
- Navigate to the project directory
cd psychiatrist-platform
- Install the dependencies
npm install
- Create a
.env
file in the root directory and add the following environment variables
PORT=3000
DB_HOST=localhost
DB_USER=root
DB_PASSWORD=
DB_NAME=hospitaldb
- Import the database dump file
hospitaldb.sql
in thedatabase
folder
- Run the file in
src/utils/index.js
to create the database and tables
node src/utils/index.js
This will automatically generate the random data of patients for each hospital and psychiatrist and also the hospitals and psychiatrists data
- Start the server
npm dev
- Access the APIs at
http://localhost:3000/api/patients
orhttp://localhost:3000/api/hospitals
orhttp://localhost:3000/api/psychiatrists
Express.js (Node.js)
- for building the server and APIsmysql2
- for connecting to MySQL database and executing queriesdotenv
- for loading environment variables from .env filebycrypt
- for hashing passwordsbody-parser
- for parsing request bodiesswagger-ui-express
- for API documentationfaker
- for generating fake data for making the dummy data for insertionmulter
- for uploading files
- GET /api/patients - Get all patients
- GET /api/patients/:id - Get a patient by id
- POST /api/patients/register - Register a patient
- PUT /api/patients/:id - Update a patient by id
- DELETE /api/patients/:id - Delete a patient by id
- GET /api/hospitals - Get all hospitals
- GET /api/hospitals/:id - Get a hospital by id
- GET /api/hospitals/details/:id - Get a hospital details by id
- GET /api/psychiatrists - Get all psychiatrists
- GET /api/psychiatrists/:id - Get a psychiatrist by id
- Interactive API documentation is available via Swagger UI. You can access it at:
- Postman collection is available in the
psychiatrist-platform.postman_collection.json
file
- Database dump is available in the
database
folder - Database schema is available in the
database
folder
hospitalId
: primary keyhospitalName
: name of the hospital
patientId
: primary keyname
: name of the patientemail
: email of the patientpassword
: password of the patientphone
: phone number of the patientaddress
: address of the patientpsychiatristId
: foreign keyphoto
: photo of the patient
psychiatristId
: primary keyname
: name of the psychiatristhospitalId
: foreign key