Skip to content

This project demonstrates the usage of Spring Data REST to create A RESTful API from JPA data models :octocat:

Notifications You must be signed in to change notification settings

TmaneChouaib/spring-data-rest-api-Demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Spring Spring-Data-Rest-App-Demo - Library app Spring

🔎 Table of Contents:

📎 About:

  • This project demonstrates the usage of Spring Data REST to create A RESTful API from JPA data models.

📎 Objective:

  • The main objective of this demo is to provide a simple yet comprehensive example of building a web application with Spring Data REST.

  • The project emphasizes the usage of Spring Data REST to expose JPA entities as a RESTful API, simplifying API development without requiring explicit controller logic.

📎 Features:

  • Automatic exposure of JPA entities as RESTful API.
  • CRUD operations management on entities via REST endpoints.

📎 Endpoints:

RESTful Endpoints naming convention:

  • Spring Data Rest follows a naming convention to expose RESTful endpoints based on JPA entities. Here's samurazed table outlining this convention:
Endpoint HTTP Method Description
{entity} GET Retrieves the complete list of entities.
{entity} POST Create a new entity.
{entity}/{id} GET Retrieves the details of a specific entity.
{entity}/{id} PUT Updates the information of an existing entity.
{entity}/{id} DELETE Delete an existing entity.
  • The API endpoints are automatically generated by Spring Data REST and can be explored using the Swagger OpenAPI UI.
  • After launching the application, you can access the Swagger documentation here.
  • Alternatively, you can simply refer to the table below, which displays the available endpoints.

Authors Endpoints

Endpoint HTTP Method Description
authors GET Retrieves the complete list of authors.
authors POST Create a new author.
authors/{id} GET Retrieves the details of a specific author.
authors/{id} PUT Updates the information of an existing author.
authors/{id} DELETE Delete an existing author

Books Endpoints

Endpoint HTTP Method Description
books GET Retrieves the complete list of books.
books POST Create a new book.
books/{id} GET Retrieves the details of a specific book.
books/{id} PUT Updates the information of an existing book.
books/{id} DELETE Delete an existing book

📎 Project Structure:

spring-data-rest-demo/
│
├── src/
│   ├── main/
│   │   ├── java/
│   │   │   └── com/
│   │   │       └── tmane/
│   │   │           └── springdatarestdemo/
│   │   │               ├── entity/
│   │   │               │   ├── Author.java
│   │   │               │   └── Book.java
│   │   │               ├── repository/
│   │   │               │   ├── AuthorRepository.java
│   │   │               │   └── BookRepository.java
│   │   │               └── SpringDataRestDemoApplication.java
│   │   │
│   └── resources/
│       └── application.properties
│
├── pom.xml
└── README.md

📎 Used technologies:

  • Spring Boot
  • Spring Data JPA
  • Spring Data REST
  • Swagger OpenAPI
  • MySQL Database

📎 Contacts:

End


About

This project demonstrates the usage of Spring Data REST to create A RESTful API from JPA data models :octocat:

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages