A sample application in kotlin, spring-boot using h2 database. It consist in a CRUD of entity Product {id, name, sku}
You need in your machine JDK 1.8+ and Git.
Clone project
$ git clone [email protected]:betorcs/guild-spring-boot.git
$ cd guild-spring-boot/
$ set GRADLE_OPTS=-Xms64m -Xmx128m
$ ./gradlew bootRun
Using browser access http://localhost:8080/h2
- Fetch products
$ curl -XGET http://localhost:8080/product
[
{
"name": "Mouse",
"sku": "M001",
"id": 1
},
{
"name": "Monitor",
"sku": "M002",
"id": 2
}
]
- Add product
$ curl -XPOST http://localhost:8080/product -H "Content-Type: application/json" -d '
{
"name": "Trackpad",
"sku": "T234"
}'
{
"name": "Trackpad",
"sku": "T234",
"id": 3
}
- Get product by sku
$ curl -XGET http://localhost:8080/product/M002
{
"name": "Monitor",
"sku": "M002",
"id": 2
}
- Delete product by product ID
$ curl -XDELETE http://localhost:8080/product/2
$ ./gradlew bootRepackage
$ cd build/libs/
$ java -Xms64m -Xmx128m -jar guild-spring-boot-0.0.1-SNAPSHOT.jar --server.port=20400