This project is a pharmacy management system that includes user authentication and information retrieval.
We welcome contributions from the community! Please follow the steps below to set up the project locally and start contributing.
- Clone the repository:
git clone https://github.com/your-username/pharmacy.git
cd pharmacy- Install dependencies for the server:
cd server
npm install- Install dependencies for the client:
cd ../client
npm install-
Set up environment variables: Create a
.envfile in theserverdirectory and add the necessary environment variables. Refer toserver/.env.examplefor the required variables. -
Run the development server:
cd ../server
npm run dev- Run the client:
Open a new terminal and navigate to the
clientdirectory:
cd client
npm start- Run tests for the server:
cd ../server
npm test- Create a new branch:
git checkout -b feature/your-feature-name- Make your changes and commit them:
git commit -m "Add your commit message"- Push to your branch:
git push origin feature/your-feature-name- Create a pull request: Go to the repository on GitHub and create a pull request from your branch.
This project is built using the MERN stack:
- MongoDB: A NoSQL database for storing and retrieving data.
- Express.js: A web application framework for Node.js.
- React: A JavaScript library for building user interfaces.
- Node.js: A JavaScript runtime for server-side programming.
This project provides a backend system for managing a pharmacy, including user authentication and user information retrieval.
Endpoint: /user/login
Method: POST
Request Body:
{
"email": "string",
"password": "string"
}Response:
200 OKon successful login400 Bad Requeston invalid credentials500 Internal Server Erroron server error
Example:
curl -X POST http://localhost:5000/user/login -d '{"email":"user1@example.com", "password":"password123"}' -H "Content-Type: application/json"Endpoint: /user/register
Method: POST
Request Body:
{
"fullname": {
"firstname": "string",
"lastname": "string"
},
"email": "string",
"password": "string",
"phone": "string"
}Response:
201 Createdon successful registration500 Internal Server Erroron server error
Example:
curl -X POST http://localhost:5000/user/register -d '{"fullname":{"firstname":"John", "lastname":"Doe"}, "email":"john.doe@example.com", "password":"password123", "phone":"1234567890"}' -H "Content-Type: application/json"Endpoint: /user/userinfo
Method: GET
Headers:
Authorization: Bearer <token>
Response:
200 OKwith user information401 Unauthorizedif token is invalid or missing404 Not Foundif user not found500 Internal Server Erroron server error
Example:
curl -X GET http://localhost:5000/user/userinfo -H "Authorization: Bearer <token>"URL: /reminder/create
Method: POST
Headers:
Content-Type: application/jsonCookie: token=<JWT_TOKEN>
Body:
{
"medicineName": "Medication Name",
"times": ["08:00", "20:00"],
"frequency": "daily"
}Response:
201 Createdon success401 Unauthorizedif no token is provided400 Bad Requestif the token is invalid
URL: /reminder/getAll
Method: GET
Headers:
Cookie: token=<JWT_TOKEN>
Response:
200 OKwith a list of reminders401 Unauthorizedif no token is provided400 Bad Requestif the token is invalid
URL: /reminder/delete/:id
Method: DELETE
Headers:
Cookie: token=<JWT_TOKEN>
Response:
200 OKon successful deletion401 Unauthorizedif no token is provided400 Bad Requestif the token is invalid
URL: /api/products
Method: POST
Headers:
Content-Type: multipart/form-data
Body:
image: Image filedata: JSON string containing product details
Example:
{
"name": "Product Name",
"category": "Category",
"price": 100,
"discount": 10,
"stock": 50,
"manufacturer": "Manufacturer",
"expiryDate": "2023-12-31",
"countryOfOrigin": "Country",
"description": "Product description",
"usage": "Usage instructions",
"sideEffects": "Possible side effects"
}Response:
201 Createdon success400 Bad Requestif image or data is missing500 Internal Server Erroron server error
URL: /api/products
Method: GET
Response:
200 OKwith a list of products500 Internal Server Erroron server error
URL: /api/products/:id
Method: GET
Response:
200 OKwith product details404 Not Foundif product not found500 Internal Server Erroron server error
URL: /api/products/:id
Method: PUT
Body:
{
"name": "Updated Product Name",
"category": "Updated Category",
"price": 120,
"discount": 15,
"stock": 60,
"manufacturer": "Updated Manufacturer",
"expiryDate": "2024-12-31",
"countryOfOrigin": "Updated Country",
"description": "Updated description",
"usage": "Updated usage instructions",
"sideEffects": "Updated possible side effects"
}Response:
200 OKon successful update404 Not Foundif product not found500 Internal Server Erroron server error
URL: /api/products/:id
Method: DELETE
Response:
200 OKon successful deletion404 Not Foundif product not found500 Internal Server Erroron server error
