Skip to content

EvangelosSyrmos/packagingCalculator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Packaging Calculator

This repository holds the codebase of a packaging calculator application.

Frontend

Figure

The frontend consists of an input field for the quantity and the ability to select the default pack sizes, or to enter a custom set of pack sizes (in a comma-separated format).

Once the solution is calculated a field under the button will display the set of pack sizes and their respective quantities needed to fulfill the requested order quantity.

The public frontend can be reached at: Public Frontend

Backend

The backend exposes a REST API with the following endpoints:

  • POST <url>/api/v1/packaging?quantity=<int>&packSizes=<int,int,int,...>:

    • quantity: The total quantity of items to be packed.
    • packSizes: A comma-separated list of available pack sizes (e.g., 1,2,3,5,10).

    This endpoint returns a JSON object containing the optimal packaging solution, which includes the number of each pack size needed to fulfill the requested quantity.

  • POST <url>/api/v1/packaging?quantity=<int>:

    • quantity: The total quantity of items to be packed. This endpoint uses the default pack sizes (250, 500, 1000, 2000, 5000) and returns a JSON object containing the optimal packaging solution.
  • GET <url>/ping: Returns {"message": "pong"} to check if the server is running.

The public API is available at: Public API

Local Testing

In order to run both service locally, Docker is required. Afterwards follow the steps:

  1. Clone the repository:

    git clone https://github.com/EvangelosSyrmos/packagingCalculator.git
  2. Navigate to the project directory:

     cd packagingCalculator
  3. Build the Docker containers

    docker compose up -d 
  4. Access the frontend at http://localhost:3000 and the backend at http://localhost:8080.

Testing

To run the available tests against the backend algorithm, navigate to the backend directory and run:

  cd backend

and then run:

    go test -v ./...

About

Packaging Calculator

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors