Microservice to control a product inventory.
Also, a Spring Boot app template.
$ mvn clean install
Create a database and configure in properties file: application.properties
After, run the app:
$ mvn spring-boot:run
Build image from a Dockerfile:
$ docker build -t inventory:latest .
Run docker:
$ docker run -p 8080:8080 --env DATABASE_URL=<DATABASE_URL> --env DATABASE_USER=<DATABASE_USER> --env DATABASE_PASSWORD=<DATABASE_PASSWORD> <DOCKER_APP_ID>
$ curl -X POST https://keepinventory.herokuapp.com/products \
-H "Content-Type: application/json" \
-d '{"name":"Ball","description":"Soccer ball","quantity":10}'
$ curl -X GET https://keepinventory.herokuapp.com/products/2
{
id: 2,
name: "Ball",
description: "Soccer ball",
quantity: 10
}
$ curl -X PUT https://keepinventory.herokuapp.com/products/2 \
-H "Content-Type: application/json" \
-d '{"name":"Ball","description":"Soccer ball","quantity":11}'
$ curl -X DELETE https://keepinventory.herokuapp.com/products/2
$ curl -X GET https://keepinventory.herokuapp.com/products/find/Ball
[
{
id: 2,
name: "Ball",
description: "Soccer ball",
quantity: 10
}
]
The MIT License (MIT)