Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Hamedblue1381 authored Feb 20, 2024
1 parent 2c12d87 commit b040ec2
Showing 1 changed file with 130 additions and 12 deletions.
142 changes: 130 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,148 @@
- [Getting Started](#getting-started)
- [Installation](#installation)
- [Web Application Setup](#web-application-setup)
- [Build the Web App](#to-start-the-web-app)
```bash
make build
```


- [With CLI (Command Line Interface)](#cli)
- [Start CLI](#to-start-the-web-app-and-cli)
```bash
make cli
```


- [Using API](#using-api)
- [Swagger UI Link](#link-to-swagger-api)
- Access Swagger UI at this link: [][1]
- [Using API](#vending-machine-api-documentation)


## Getting Started

### Installation

#### Web Application Setup

1. Clone the repository:

```bash
git clone [https://github.com/Hamedblue1381/vending-machine.git]
cd vending-machine

#### Web Application Setup

```bash
make build
```

#### Cli

```bash
make cli
```



# Vending Machine API Documentation

Welcome to our Vending Machine API! This repository contains a simple RESTful API designed to manage vending machines and their inventory.

## Base URL

All API endpoints are accessible at `http://localhost:8080/`.

## Endpoints

### GET /item/{item}

Dispense an item by its unique identifier.

#### Request

- Method: GET
- Path: `/item/{item}`
- Parameters:
- `item` (required): The ID of the desired item.

#### Response
- Status code: 200 OK
- Body:

- Status code: 200 OK
- Body:
```json
{
"message": "Item dispensed successfully!"
}
### GET /insert
Retrieve a list of items currently available for purchase.
#### Request
- Method: GET
- Path: `/insert`
#### Response
- Status code: 200 OK
- Body:
```json
{
[
{
"ID": 1,
"Name": "Soda",
"Count": 20
},
{
"ID": 2,
"Name": "Coffee",
"Count": 19
}
]
}

### GET /machines

Obtain information about existing vending machines and their current stock levels.

#### Request

- Method: GET
- Path: `/machines`

#### Response

- Status code: 200 OK
- Body:
```json
{
[
{
"id": 0,
"stock": 40,
"coins": 0,
"items": [
{
"ID": 1,
"Name": "Soda",
"Count": 20
},
{
"ID": 2,
"Name": "Coffee",
"Count": 20
}
]
}
]
}
```
### POST /add-machine

Add a new vending machine to the system.

#### Request

- Method: POST
- Path: `/add-machine`
- Body:
```json
{
"count": 20
}
```

0 comments on commit b040ec2

Please sign in to comment.