Skip to content

leowilbur/tbox

Repository files navigation

TBOX Backend Project CircleCI

This repository contains an implementation of the TBOX API. All the endpoints have been described in the Swagger definition.

Project structure

  • .circleci contains all files related to the CI process,

  • migrations contains all the SQL migrations,

  • pkg:

    • models contains all the data model declarations and a basic CRUD layer,
    • rest, service contains an implementation of the REST API,
    • utils has all the utility helpers,
  • vendor is the Go vendor directory,

  • Gopkg.lock, Gopkg.toml is the configuration of go-dep for package management,

  • the root directory contains mostly configuration files

Code development guide

This project uses dep for dependency management, ginkgo for testing and migrate for running database migrations.

# Using go-dep to install dependency packages
dep ensure -v

# Using ginkgo for unit test
ginkgo -r -skipPackage=vendor --randomizeSuites --failOnPending --cover --trace --race --progress

# Or using the standard go test
go test -v ./...

# Using migrate for data migration
migrate -source file://./migrations -database "mysql://root:root@tcp(127.0.0.1:3306)/tbox" up

In order to make setting it up easier, there's a docker-compose.yml , which contain the mysql image:

# Using docker-compose file to run mysql server localhost with port 3306
sudo docker-compose up -d
# Starting api 
go run main.go
# Send otp code to user phone number
curl -X POST \
  http://localhost:8080/users/otp/generate \
  -H 'Content-Type: application/json' \
  -d '{
	"phoneNumber":"0915558493"
}'
# Validate the otp with user phone number
curl -X POST \
  http://localhost:8080/users/otp/validate \
  -H 'Content-Type: application/json' \
  -d '{
	"phoneNumber":"0908280493",
	"otp": "123456"
}'

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages