Skip to content

robertoduessmann/inventory

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

55 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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)

About

Spring Boot microservice to control a product inventory

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published