Currency conversion API is a GraphQL API that provides a small service converting Euro to US Dollar and vice-versa.
Access to convert
is protected with Access Key that can be generated by creating a new project:
mutation {
createProject(project: {name: "Project"}){
name
accessKey
}
}
To access convert
query use project's accessKey
as an Authorization
header:
convert(from: EUR to: USD amount: 10) {
timestamp
rate
result
}
- Golang
- GraphQL
- Docker
- Docker Compose
- Go library for building GraphQL servers – https://github.com/99designs/gqlgen
- Structured logger for Go (golang) – https://github.com/sirupsen/logrus
- Go library for UUID generation – https://github.com/google/uuid
- Foreign exchange rates and currency conversion JSON API – https://fixer.io
Use https://github.com/99designs/gqlgen to get basic knowledge
- Do change in
.graphqls
files - Run generator to generate new or update code according to new schema
$ make regenerate
- Implement resolvers according to your needs
Execute command
$ make run
Run the playground in browser: http://localhost:3000
Execute command
$ make test
To build a container Docker and Docker-Compose has to be installed:
To run an application using docker-compose
use next command:
$ docker-compose up
Run the playground in browser: http://localhost:3000