Skip to content

betorcs/guild-spring-boot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

What's it?

A sample application in kotlin, spring-boot using h2 database. It consist in a CRUD of entity Product {id, name, sku}

What do you need?

You need in your machine JDK 1.8+ and Git.

How do you get the code?

Clone project

$ git clone git@github.com:betorcs/guild-spring-boot.git

Launching application

$ cd guild-spring-boot/
$ set GRADLE_OPTS=-Xms64m -Xmx128m
$ ./gradlew bootRun

Access database

Using browser access http://localhost:8080/h2

Operations

  • 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

Building and lauching application in port 20400

$ ./gradlew bootRepackage
$ cd build/libs/
$ java -Xms64m -Xmx128m -jar guild-spring-boot-0.0.1-SNAPSHOT.jar --server.port=20400

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published