Task README

Running & Building application

Download dependencies with:

$ go mod tidy && go mod vendor

Run application with:

$ go run main.go

Build application with:

$ go build -o xquestions main.go

Access the GraphiQL interface: Open browser to http://localhost:{PORT}/graphiql

Screenshot 2021-03-28 at 15 50 48

Live GraphiQL Playground: Heroku App

Running Tests

In the root of the application, run go test ./... to run all test suites

GRAPHQL Definitions

CalculatePrice Query

Definitions

  • type:string
  • margin:string

Query

query CalculatePrice {
  calculatePrice(type: "buy", margin: 0.2, exchangeRate: 476)
}

Response

{
  "data": {
    "calculatePrice": 26467774.368
  }
}