Restful CRUD API for a simple note taking application using Spring Boot, Mysql, JPA and Hibernate.
- Clone the application:
git clone https://github.com/brenddesigns/notes-app-rest-api.git
- Create MySQL database:
CREATE DATABASE notes_app;
- Change MySQL username and password inside application.properties file:
- Open
src/main/resources/application.properties
- Change
spring.datasource.username
andspring.datasource.password
as per your installation.
- Build and Run the application using Maven:
mvn package
java -jar target/notes-app-rest-api-1.0.0.jar
Alternatively, you can run the app without packaging it using:
mvn spring-boot:run
The app will start running at http://localhost:8080.
The following explores the CRUD (Create, Remove, Update AND Delete) operations this application supports. In the screenshots below, I am using Postman to perform the API calls.
- Get all notes using GET method:
GET localhost:8080/api/v1/notes
- Get note with a specific ID using GET method:
GET localhost:8080/api/v1/notes/{noteId}
In the screenshot below, we are returning the note with the ID of 1
- Add a note using POST method:
POST localhost:8080/api/v1/notes
In the screenshot below, we are adding a new note
- Update an existing note using PUT method:
PUT localhost:8080/api/v1/notes/{noteId}
In the screenshot below, we are updating the note with the ID of 2
- Delete a note using DELETE method:
DELETE localhost:8080/api/v1/notes/{noteId}
In the screenshot below, we are deleting the note with the ID of 2