Skip to content

Service to serve information about Administrative Division a country

License

Notifications You must be signed in to change notification settings

dynastymasra/cartographer

Repository files navigation

Cartographer

Go Docker Seabolt Build Status codecov Go Report Card

Service to serve information about Administrative Division a country

Try API on cartographer.shajaro.com

Libraries

Use Go Module for install all dependencies required this application.

How To Run and Deploy

Before run this service. Make sure all requirements dependencies has been installed likes Golang, Docker, and database Neo4J

Local

Use command go go run main.go in root folder for run this application.

Docker

cartographer uses docker multi stages build, minimal docker version is 17.05. If docker already installed use command.

This command will build the images.

docker build -f Dockerfile -t cartographer:$(VERSION) .

To run service use this command

docker run --name cartographer -d -e ADDRESS=:8080 -e <environment> $(IMAGE):$(VERSION)

Test

For run unit test, from root project you can go to folder or package and execute command

go test -v -cover -coverprofile=coverage.out -covermode=set
go tool cover -html=coverage.out

go tool will generate GUI for test coverage. Available package or folder can be tested

  • /country
  • /country/handler
  • /region
  • /region/handler
  • /infrastructure/web/handler

Environment Variables

  • SERVER_PORT - Address application is used default is 8080
  • LOGGER_LEVEL - Log level(debug, info, error, warn, etc)
  • LOGGER_FORMAT - Format specific for log
    • text - Log format will become standard text output, this used for development
    • json - Log format will become JSON format, usually used for production
  • NEO4J_ADDRESS - Neo4J database address bolt+routing://<host>:<port>
    • bolt+routing:// - Used with causal cluster
    • bolt:// - Used with single server
  • NEO4J_USERNAME - Neo4J database username
  • NEO4J_PASSWORD - Neo4J database password
  • NEO4J_MAX_CONN_POOL - Neo4j maximum number of connections per URL to allow on this driver
  • NEO4J_ENCRYPTED - Neo4J whether to turn on/off TLS encryption (true/false)
  • NEO4J_LOG_ENABLED - Neo4J database log enabled (true/false)
  • NEO4J_LOG_LEVEL Neo4J type that default logging implementations use for available default 0
    • 0 - Doesn't generate any output
    • 1 - Level error
    • 2 - Level warning
    • 3 - Level info
    • 4 - Level debug

API Documentation

This service use GraphQL to serve the request, Run in Postman

Available Administrative Division