Skip to content

AnguleMathias/pariti-test-vending-machine

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Vending Machine API

This project implements a basic vending machine API with TypeScript, Node.js, and Express.

Table of Contents

Routes

Maintenance User

Method Route Description
GET /maintenanceUser/products Get all products available.
GET /maintenanceUser/products/{productId} Get a product by ID.
POST /maintenanceUser/createProduct Create a new product.
PUT /maintenanceUser/setPrice/{productId} Set the price for a product.
PUT /maintenanceUser/adjustQuantity/{productId} Adjust the quantity of a product.
DELETE /maintenanceUser/deleteProduct/{productId} Delete a product by ID.
GET /maintenanceUser/getCoins Get all coins available in the machine.
POST /maintenanceUser/createCoins Create coins.
PUT /maintenanceUser/updateCoins Update coins available in the machine.
DELETE /maintenanceUser/deleteCoin/{coinValue} Delete a coin by coin value.

Regular User

Method Route Description
GET /regularUser/products Get all products available.
GET /regularUser/products/{productId} Get a product by ID.
POST /regularUser/buyProduct Buy a product by specifying product slot and coins.

Getting Started

Prerequisites

Installation

  1. Navigate to project folder

cd vending-machine-api

  1. Install the dependencies:

npm install

Running the App

Run the app:

For production:

npm start

For development:

npm run dev

This setup assumes you have tsc (TypeScript compiler) and nodemon installed globally or as devDependencies. If not, you can install them using:

npm install -g typescript nodemon

The API will be available at http://localhost:3000.

API Documentation

API documentation is generated using Swagger and can be accessed at http://localhost:3000/api-docs.

Running Tests

For tests with coverage

npm run test

Viewing Coverage Report:

open coverage/lcov-report/index.html

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published