yashtank86 / customer-api-springboot

customer api using spring boot framework with a jpa thymeleaf hibernate mysql with this all features created rest api.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Customer API Documentation

customer api - spring boot application. This api is built with Spring Boot, utilizing MySQL for data storage. It exposes endpoints to manage customer information, including id, first_name, last_name, email, and phone_number. The API is designed to be powerful, scalable, and easy to integrate into your applications.

Note

    It's My First Springboot Back-end Project In which I have Implemented Rest API
    and also uses postman to test api:)

    🌟 Thank you, me, for making it happen! Let's keep coding and building awesome things! πŸš€

    πŸš€ Key Achievements:

    Developed a RESTful API that showcases my proficiency in Java and Spring Boot.
    Successfully handled the integration of MySQL, ensuring data persistence and reliability.
    Demonstrated a commitment to best practices, documentation, and a user-friendly API design.

Prerequisites

    Maven 3+.
    MySQL Workbench 8+.
    Postman v9+.

Generate the Project

    Go to the website Spring Initializr to initialize the Spring Boot project. Add the following dependencies:
    Spring Boot DevTools: for the development tools.
    Lombok: to reduce boilerplate code (for example, getters and setters).
    Spring Web: to embed Apache Tomcat and include Spring MVC.
    Spring Data JPA: to facilitate the database layer.
    MySQL Driver: to enable communication between the Spring Boot application and the database.

Navigate to the project directory:

Directory Structure
image

Configure the MySQL database connection in application.properties.

spring.datasource.url = jdbc:mysql://localhost:9090/customer-management-system
spring.datasource.username = root
spring.datasource.password = root
spring.jpa.hibernate.ddl-auto = update
spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQLDialect

server.error.include-stacktrace = never

server.port = 8090

mvn spring-boot:run

The API will be accessible at http://localhost:8090/customer/save for POST method.
http://localhost:8090/customer/retrieve/email=abc@gmail.com 
:= for GET method. Its uses emailId for retrieve the information from database

Testing with Postman

    Test the application using Postman.
    Add a couple of customers.
    
    Enter the body of the request:
    
    {
        "first_name": "rahul",
        "last_name": "sharma",
        "email": "rs@gmail.com",
        "phoneNumber": "9515517878"
    }

Select SEND, and rahul sharma will be saved into the database

MySql
image

The project utilizes the following Tech:

🌐 Tech Stack:
πŸ–₯️ Java | Spring Boot | Hibernate
πŸ›’οΈ MySQL
πŸš€ RESTful APIs
πŸ”§ Git | Maven

All dependencies are managed using Maven.

Screenshorts

GET {retrieve an customer from database using emailID}
img1
Screen2
img2
mysql workbanch
img3
POST {Create an customer}
img4

Usage

Make requests to the specified endpoints using your preferred API client.
Ensure proper authorization and authentication mechanisms are in place.
Integrate the API into your applications to manage customer data efficiently.

Contribution

Contributions are welcome! If you find any issues or have suggestions for improvements, feel free to open an issue or submit a pull request.

License

This project is licensed under the MIT License.

About

customer api using spring boot framework with a jpa thymeleaf hibernate mysql with this all features created rest api.


Languages

Language:Java 100.0%