Giter Site home page Giter Site logo

golang-gin's Introduction

golang-gin

Go Module Init

go mod init gitlab.com/alansuparlan/golang-gin

Gin-Gonic library: github.com/gin-gonic/gin

Run

go run server.go

Swagger Documentation

go get -u github.com/swaggo/swag/cmd/swag

Generate Swagger Documentation

swag init

setelah nanti di masuk Swagger Ui masukan jwt token diawali dengan Bearer

Deploy on AWS ElasticBeanstalk from EB CLI

1.- Create user (e.g "beanstalk") and allow Programmatic Access

2.- Create new group ( e.g. "Beanstalk")

3.- Attach AWSElasticBeanstalkFullAccess policy to the group

4.- Add the user to the Group

5.- Copy user's aws_access_key_id and aws_secret_access_key to .aws/config file

6.- From the application directory run:

6.a.- eb init

6.b.- eb create --single

Deploy on AWS ElasticBeanstalk with Docker

Build the docker image

docker build --tag alansuparlan/golang-gin .

Run the container locally

docker run -p 5000:5000 alansuparlan/golang-gin

Push the image to DockerHub (you need a DockerHub account)

docker login
docker push alansuparlan/golang-gin

Golang clean-architecture codebase example containing real world examples (CRUD, auth, advanced patterns, etc) that adheres to the RealWorld spec and API.

Getting started

Build the app

make

Run the app

./go-realworld-clean

Run the integration tests

Start the server with an existing user

./go-realworld-clean --populate=true

In another terminal, run the tests against the API

newman run api/Conduit.postman_collection.json \
  -e api/Conduit.postman_integration_test_environment.json \
  --global-var "[email protected]" \
  --global-var "PASSWORD=password"

Additional

Make Targets

The version is either 0.1.0 if no tag has ever been defined or the latest tag defined. The build number is the SHA1 of the latest commit.

  • make: Builds and injects version/build in binary
  • make init: Sets the pre-commit hook in the repository
  • make docker: Build docker image and tag it with both latest and version
  • make latest: Build docker image and tag it only with latest
  • make test: Executes the test suite
  • make mock: Generate the necessary mocks
  • make clean: Removes the built binary if present

golang-gin's People

Contributors

alansuparlan avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.