Skip to content

Medicine-Controller project simplifies the management of medicines in a pharmacy setting, making it easier to add new medicines and keep existing ones up to date through a user-friendly API

License

Notifications You must be signed in to change notification settings

RachamallaYeswanthReddy/MedicinePharamcyAPI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Medicine Pharmacy API

Introduction

This is a Medicine Pharmacy API developed using Spring Boot, Java, and MySQL. It allows you to manage medicines in a pharmacy system by providing endpoints for adding new medicines and updating existing ones.

  • A SpringBoot REST API built for its Client

Prerequisites

Before you start using this API, make sure you have the following installed:

  • Java Development Kit (JDK)
  • Spring Boot
  • MySQL Database
  • Postman (for testing)

Setup

  1. Clone the repository:

bash git clone https://github.com/RachamallaYeswanthReddy/Medicine-Controller.git cd Medicine-Controller

  1. Configure the MySQL database by editing the application.properties file in the src/main/resources directory. Update the database URL, username, and password according to your MySQL setup.

  2. Build and run the application:

bash ./mvnw spring-boot:run

The API will be accessible at http://localhost:8080.

API Endpoints

Add Medicine

  • Endpoint: POST /medicines

  • Request Body: json { "medicineName": "Paracetamol", "price": 5.99, "quantity": 200, "description": "Common pain and fever medication" }

  • Response: Returns "true" if the medicine is successfully added, otherwise false.

image

Update Medicine

  • Endpoint: PUT /medicines/{medicineId}

  • Request Body: json { "medicineName": "Paracetamol", "price": 5.99, "quantity": 200, "description": "Common pain and fever medication" }

  • Response: Returns the updated Medicine object.

image

Usage

You can use Postman or any other API testing tool to interact with the endpoints.

  1. Open Postman.

  2. Create a new collection and add new request.

  3. Set the request method (POST or PUT), URL (e.g., http://localhost:8080/medicines), and add the request body as described above.

  4. Send the request to test the API.

Follow the steps below

  • Clone this repository
  • Create a MySql database with the name medicine
  • You can create the database with any name you like. Make sure to update the datasource url in application.properties
  • If your datasource username and password are not the defaults username(root) and password(" ") , then update their values inapplication.properties
  • Run the code given in the textfile mysql in the MYSQL Workbench image

License

This project is licensed under the MIT License - see the LICENSE file for details.

Please make sure to update your repository link in the clone URL and any other specific details in the README according to your project's requirements.

About

Medicine-Controller project simplifies the management of medicines in a pharmacy setting, making it easier to add new medicines and keep existing ones up to date through a user-friendly API

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages