This project is a REST API that connects to an H2 database using Spring Boot.
- RESTful API with CRUD operations
- In-memory H2 database for testing and development
- Spring Data JPA for database interaction
- Maven for dependency management
- Java 11 or higher
- Maven 3.6.3 or higher
The following dependencies are included in the pom.xml:
- Spring Web
- Spring Dev Tools
- H2 Database
- Spring Data JPA
git clone https://github.com/your-username/your-repo-name.git
cd your-repo-name
mvn clean install
mvn spring-boot:run
The application will start on http://localhost:8080.
Here are some example endpoints for the USERS table:
GET /api/users- Retrieve all usersGET /api/users/{id}- Retrieve a specific user by IDPOST /api/users- Create a new userPUT /api/users/{id}- Update an existing user by IDDELETE /api/users/{id}- Delete a user by ID
curl -X GET http://localhost:8080/api/users
curl -X POST http://localhost:8080/api/users -H "Content-Type: application/json" -d '{"name": "New User", "email": "user@example.com"}'
You can access the H2 database console at http://localhost:8080/h2-console. Use the following settings:
- JDBC URL:
jdbc:h2:mem:testdb - Username:
sa - Password: (leave blank)
If you'd like to contribute, please fork the repository and use a feature branch. Pull requests are warmly welcome.
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
- Spring Boot documentation
- H2 Database documentation