https://github.com/ddobrin/spring-mysql-jpa
https://github.com/ddobrin/spring-mysql-jpa
Last synced: 12 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/ddobrin/spring-mysql-jpa
- Owner: ddobrin
- License: apache-2.0
- Created: 2021-04-05T20:55:21.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2021-04-05T21:01:12.000Z (over 5 years ago)
- Last Synced: 2024-10-06T02:05:37.610Z (almost 2 years ago)
- Language: Java
- Size: 59.6 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Introduction
This is a Spring Boot application that accesses a MySql Database. The data model is a `User` that has an id, name and email address. There is one controller with two endpoints:
* `/demo/all` - lists all users (GET REQUEST)
* `/demo/add` - add a user (POST REQUEST)
# Build and run
To build the uberjar execute
```
./mvnw clean package
```
And run using `java -jar ./target/accessing-data-mysql-0.0.1-SNAPSHOT.jar`
# Using
To view the users
```
curl 'localhost:8080/demo/all'
```
To add a user
```
curl -X POST localhost:8080/demo/add -d name=First -d email=someemail@someemailprovider.com
```