Skip to content

This is a base repositry for people to refer for crud opertions using VS Code.

License

Notifications You must be signed in to change notification settings

lgsurith/springboot-h2-db-crud

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CRUD Application with H2 Database using Spring Boot

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.

Setup

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 in application-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

API Endpoints

  • GET - /users/test

    To Check if the port works :)

    test

  • GET - /users

    Gets all the users !

    all

  • POST - /users

    Allows the user to add name and email to h2-db.

    post

  • GET - /users/id

    Get a user by an unique ID.

    id-user

  • PUT -/users/id

    To update users information by their unique ID.

    update

  • DELETE -/users/id

    To delete the user by their unique ID.

    delete

h2 console :

result

About

This is a base repositry for people to refer for crud opertions using VS Code.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages