Giter Site home page Giter Site logo

goshop's Introduction

Go Shop

Master codecov GitHub go.mod Go version GitHub

An example of gin contains many useful features for e-commerce websites

How to run

Required Environment

  • Postgres
  • Redis

You can see the docker compose file here to set up required environment

Config

  • Copy config file: cp pkg/config/config.sample.yaml pkg/config/config.yaml
  • You should modify pkg/config/config.yaml
environment: production
http_port: 8888
grpc_port: 8889
auth_secret: ######
database_uri: postgres://username:password@host:5432/database
redis_uri: localhost:6379
redis_password:
redis_db: 0

Run

$ go run cmd/api/main.go 
2023-09-12T15:18:36.684+0700    INFO    http/server.go:58       HTTP server is listening on PORT: 8888
2023-09-12T15:18:36.684+0700    INFO    grpc/server.go:53       GRPC server is listening on PORT: 8889

Test

$ go test

Test with Coverage

go test -timeout 9000s -a -v -coverprofile=coverage.out -coverpkg=./... ./...

or

make unittest

Document

  • API document at: http://localhost:8888/swagger/index.html

Tech stack

  • Restful API
  • GRPC
  • DDD
  • Gorm
  • Swagger
  • Logging
  • Jwt-Go
  • Gin-gonic
  • Redis

What's next?

  • gRPC functions for products and orders
  • Push message to notify place order successfully
  • Payment with PayPal
  • Define error response wrapper

goshop's People

Contributors

quangdangfit 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.