Coder Social home page Coder Social 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 config/config.sample.yaml config/config.yaml
  • You should modify 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 

Test

$ go test

Test with Coverage

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

Project information and existing API

[GIN-debug] POST   /api/v1/auth/register     --> goshop/internal/user/port/http.(*UserHandler).Register-fm (3 handlers)
[GIN-debug] POST   /api/v1/auth/login        --> goshop/internal/user/port/http.(*UserHandler).Login-fm (3 handlers)
[GIN-debug] POST   /api/v1/auth/refresh      --> goshop/internal/user/port/http.(*UserHandler).RefreshToken-fm (4 handlers)
[GIN-debug] GET    /api/v1/auth/me           --> goshop/internal/user/port/http.(*UserHandler).GetMe-fm (4 handlers)
[GIN-debug] PUT    /api/v1/auth/change-password --> goshop/internal/user/port/http.(*UserHandler).ChangePassword-fm (4 handlers)
[GIN-debug] GET    /api/v1/products          --> goshop/internal/product/port/http.(*ProductHandler).ListProducts-fm (3 handlers)
[GIN-debug] POST   /api/v1/products          --> goshop/internal/product/port/http.(*ProductHandler).CreateProduct-fm (4 handlers)
[GIN-debug] PUT    /api/v1/products/:id      --> goshop/internal/product/port/http.(*ProductHandler).UpdateProduct-fm (4 handlers)
[GIN-debug] GET    /api/v1/products/:id      --> goshop/internal/product/port/http.(*ProductHandler).GetProductByID-fm (3 handlers)
[GIN-debug] POST   /api/v1/orders            --> goshop/internal/order/port/http.(*OrderHandler).PlaceOrder-fm (4 handlers)
[GIN-debug] GET    /api/v1/orders/:id        --> goshop/internal/order/port/http.(*OrderHandler).GetOrderByID-fm (4 handlers)
[GIN-debug] GET    /api/v1/orders            --> goshop/internal/order/port/http.(*OrderHandler).GetOrders-fm (4 handlers)
[GIN-debug] PUT    /api/v1/orders/:id/cancel --> goshop/internal/order/port/http.(*OrderHandler).CancelOrder-fm (4 handlers)
[GIN-debug] GET    /swagger/*any             --> github.com/swaggo/gin-swagger.CustomWrapHandler.func1 (3 handlers)
[GIN-debug] GET    /health                   --> goshop/internal/server/http.Server.Run.func1 (3 handlers)
2023-08-20T13:50:57.175+0700    INFO    http/server.go:53       Server is listening on PORT: 8888
[GIN-debug] Listening and serving HTTP on :8888

Document

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

Tech stack

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

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.