Skip to content

marto97/vending-machine

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Getting Started

This is a simple vending machine implemented in Java with Spring.

Requirements

For building and running the application you need:

How to Build and Run

  1. Clone the repository.
  2. Navigate to the project directory.
  3. There are several ways to run a Spring Boot application on your local machine. One way is to execute the main method in the com.martin.vending.VendingApplication class from your IDE.

Build

./mvnw clean install

Run

Navigate to the project target directory.

java -jar vending-0.0.1-SNAPSHOT.jar

Add Product

POST http://localhost:8080/api/v1/vending
Content-Type: application/json

{
"name": "Cola",
"type": "snacks",
"location": "A7",
"cost": 1.50
}

Update Product by ID

PUT http://localhost:8080/api/v1/vending/4?name=ColaLight&type=drinks&location=A8&cost=1.60
Content-Type: application/json

Remove Product by ID

DELETE http://localhost:8080/api/v1/vending/1

Purchase Product by Location

POST http://localhost:8080/purchaseProduct
Content-Type: application/json

{
  "insertedCoins": [
    {
      "value": 0.50,
      "weight": 5.0,
      "diameter": 22.5
    },
    {
      "value": 1.00,
      "weight":7.0,
      "diameter": 24.5
    }
  ],
  "productLocation": "A1"
}

Reference Documentation

For further reference, please consider the following sections:

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages