This repository contains a CRUD application developed with Spring Boot and an H2 in-memory database, using the VS Code IDE. It provides a RESTful API for performing CRUD operations on a resource.
Pre-requisites :
-
Install the Coding Pack for Java - here
-
Install Java Extension Pack and Spring Boot Extension Pack from here.
-
Refer to this youtube video to understand how to initiate a project after the above two steps : www.youtube.com/setup
-
Clone the repository
git clone https://github.com/lgsurith/springboot-h2-db-crud.git
cd springboot-h2-db-crud
- Build and run the application
mvn spring-boot:run
- Access the H2 Console : To acces the H2 Console , navigate to
http://localhost:8080/h2-console
in your web browser after starting the application to check if h2 database is connected or not , but before that please ensure to put these details inapplication-properties
spring.h2.console.enabled=true
spring.datasource.url=jdbc:h2:mem:dcbapp
spring.datasource.driverClassName=org.h2.Driver
spring.datasource.username=sa
spring.datasource.password=<your-password>
spring.jpa.database-platform=org.hibernate.dialect.H2Dialect
-
GET - /users/test
To Check if the port works :)
-
GET - /users
Gets all the users !
-
POST - /users
Allows the user to add name and email to h2-db.
-
GET - /users/id
Get a user by an unique ID.
-
PUT -/users/id
To update users information by their unique ID.
-
DELETE -/users/id
To delete the user by their unique ID.