Skip to content

Rhodanthe1116/go-gin-dynamodb

Repository files navigation

Go Gin Boilerplate

Deploy

export USERNAME=
docker build -t $USERNAME/covid-tracker-user .
docker push $USERNAME/covid-tracker-user
docker build -t $USERNAME/covid-tracker-store .
docker push $USERNAME/covid-tracker-store
docker build -t $USERNAME/covid-tracker-record .
docker push $USERNAME/covid-tracker-record

A starter project with Golang, Gin and DynamoDB

Build Status codebeat badge Go Version License FOSSA Status

Golang Gin boilerplate with DynamoDB resource. Supports multiple configuration environments.

This project use a DynamoDB base docker image.

Setup DynamoDB dependency: docker run -d -p 8080:8080 vsouza/dynamo-local --port 8080

Boilerplate structure

.
├── Makefile
├── Procfile
├── README.md
├── config
│   ├── config.go
│   ├── development.yaml
│   ├── production.yaml
│   └── test.yaml
├── controllers
│   └── user.go
├── db
│   └── db.go
├── forms
│   └── user.go
├── header.jpg
├── main.go
├── middlewares
│   └── auth.go
├── models
│   └── user.go
└── server
    ├── router.go
    └── server.go

Installation

make deps

Usage example

curl -s ${TARGET_URL}/health

Development setup

Running DynamoDB on Docker Image:

check this project: vsouza/docker-dynamoDB-local

Release History

  • 0.0.1
    • Configuration by environment, Auth and Log middlewares, User entity.

Meta

Vinicius Souza – @iamvsouza[email protected]

Distributed under the MIT license. See License for more information.

https://github.com/vsouza

APIs

TARGET_URL='http://3.224.156.234.sslip.io'
USER_PHONE='0912345678'
USER_PASS='878787'
STORE_PHONE='0987654321'
STORE_PASS='87878787'
STORE_NAME='giver'
STORE_ADDR='taipei'
curl -s -X POST ${TARGET_URL}/auth/user/signup -d "{\"phone\": \"${USER_PHONE}\", \"password\": \"${USER_PASS}\"}"
user_token=$(curl -s -X POST ${TARGET_URL}/auth/user/login -d "{\"phone\": \"${USER_PHONE}\", \"password\": \"${USER_PASS}\"}" | tee /dev/tty | sed 's/{"token":"\([^"]*\)"}/\1/')
curl -s -X POST ${TARGET_URL}/auth/store/signup -d "{\"phone\": \"${STORE_PHONE}\", \"password\": \"${STORE_PASS}\", \"name\": \"${STORE_NAME}\", \"address\": \"${STORE_ADDR}\"}"
store_token=$(curl -s -X POST ${TARGET_URL}/auth/store/login -d "{\"phone\": \"${STORE_PHONE}\", \"password\": \"${STORE_PASS}\"}" | tee /dev/tty | sed 's/{"token":"\([^"]*\)"}/\1/')
qrcode=$(curl -s -X GET ${TARGET_URL}/auth/store/profile -H "Authorization: Bearer ${store_token}" | tee /dev/tty | grep -o '"qrcode":"[^"]*"' | sed 's/"qrcode":"\([^"]*\)"/\1/')
curl -s -X POST ${TARGET_URL}/records -H "Authorization: Bearer ${user_token}" -d "{\"store_id\": \"${qrcode}\"}"

License

FOSSA Status

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published