/go-pricing

A sample go microservice

Primary LanguageGo

GO pricing microservice

This is a simple tutorial that demonstrates how to build a microservice in GoLang. It includes routes, controllers, services and tests.

This tutorial makes use of github.com/gin-gonic/gin for routing.

The code accepts a start and end date and returns a price back by applying an hourly / daily rate to the given interval.

Usage

To start the microservice:

  1. Clone the repository into your GOPATH
  2. Install realize (optional)
go get github.com/oxequa/realize
  1. Start the project
realize start
  1. Head over to http://127.0.0.1:3000/status and ensure the page loads.
  2. Send a post request
curl -X POST http://127.0.0.1:3000/pricing/calculate \
     -d 'start_date=2018-11-01T10:00:00%2B00:00&end_date=2018-11-01T15:00:00%2B00:00'
  1. You should get a price back.