Sign inSign up

robertoduessmann/inventory

By robertoduessmann

Updated almost 8 years ago

inventory

Image
1

378

robertoduessmann/inventory repository overview

inventory

Build Status codecov

Microservice to control a product inventory.
Also, a Spring Boot app template.

Installation

Build
$ mvn clean install
Running

Create a database and configure in properties file: application.properties

After, run the app:

$ mvn spring-boot:run
Running with Docker

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>

Usage

POST /products
$ curl -X POST https://keepinventory.herokuapp.com/products \
  -H "Content-Type: application/json" \
  -d '{"name":"Ball","description":"Soccer ball","quantity":10}'
GET /products/{id}
$ curl -X GET https://keepinventory.herokuapp.com/products/2
{
   id: 2,
   name: "Ball",
   description: "Soccer ball",
   quantity: 10
}
PUT /products
$ curl -X PUT https://keepinventory.herokuapp.com/products/2 \
  -H "Content-Type: application/json" \
  -d '{"name":"Ball","description":"Soccer ball","quantity":11}'
DELETE /products/{id}
$ curl -X DELETE https://keepinventory.herokuapp.com/products/2
GET /products/find/{name}
$ curl -X GET https://keepinventory.herokuapp.com/products/find/Ball
[
	{
	   id: 2,
	   name: "Ball",
	   description: "Soccer ball",
	   quantity: 10
	}
]

License

The MIT License (MIT)

Tag summary

Content type

Image

Digest

Size

618.7 MB

Last updated

almost 8 years ago

docker pull robertoduessmann/inventory