shipping-recommendations

module
v0.0.0-...-269b9e9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 19, 2022 License: MIT

README

Go Report Card swagger

Shipping Recommendations API

RESTful API that given different shipping options from an external API is able to recommend the same shipping options ordered by the best combination of cost and time.

Architecture

Shipping Recommendations API architecture is based on the Clean Architecture.

Clean Architecture

Execution

Running the API

You can run the API with the following command:

make run
Linting

To lint the API using golangci-lint, execute:

make lint
Testing

To test the API you can use the following command:

make test

And if you want to get coverage information, you can use:

make test-cover

To update mocks, use this command:

make build-mocks

Documentation

Swagger

You can find the documentation of the API at localhost:8080/swagger/index.html.

API Documentation Swagger

Examples
  • List recommended shipping options

Request:

curl -X 'GET' \
  'http://localhost:8080/api/v1/shipping-recommendations'

Response:

{
  "shipping_recommendations": [
    {
      "name": "Option 2",
      "type": "Custom",
      "cost": 5,
      "estimated_days": 4
    },
    {
      "name": "Option 3",
      "type": "Pickup",
      "cost": 7,
      "estimated_days": 1
    },
    {
      "name": "Option 4",
      "type": "Delivery",
      "cost": 10,
      "estimated_days": 3
    },
    {
      "name": "Option 1",
      "type": "Delivery",
      "cost": 10,
      "estimated_days": 5
    }
  ]
}

Dependencies

Directories

Path Synopsis
Package api GENERATED BY THE COMMAND ABOVE; DO NOT EDIT This file was generated by swaggo/swag
Package api GENERATED BY THE COMMAND ABOVE; DO NOT EDIT This file was generated by swaggo/swag
cmd
internal
vo
pkg

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL