Coder Social home page Coder Social logo

cmall-go's Introduction

CMall 电子商城

此项目已经部署至CMall,用 golang 实现接口函数,如需要看前端请前往cmall-vue

前言

本人准备大三,拿这个项目学习一些新的技能,如果有错误或者实现不好的地方欢迎 issues

后续会实现支付功能,QQ 第三方登录,重写搜索系统,优化代码和数据库,因为即将开学,后续更新的进度可能会放慢。

如果觉得这个项目不错,您可以右上角 Star 支持一下!谢谢您的支持,您的支持是我完善的动力!

项目依赖

本项目采用了一系列 golang 中比较流行的组件来进行开发

  • Gin
  • Gorm
  • mysql
  • redis
  • godotenv
  • jwt-go
  • 阿里云 OSS
  • 极验 SDK

目录结构

mall-go/
├── api
├── cache
├── conf
├── middleware
├── model
├── pkg
│	├── e
│	├── util
│   ├── sdk
├── serializer
├── server
└── service

  • api:用于定义接口函数

  • cache:redis 相关操作

  • conf:用于存储配置文件

  • middleware:应用中间件

  • model:应用数据库模型

  • pkg / e:封装错误码

  • pkg / util:工具函数

  • pkg / sdk: 极验 sdk 核心函数

  • serializer:将数据序列化为 json 的函数

  • server 路由逻辑处理

  • service:接口函数的实现

Godotenv

项目在启动的时候依赖以下环境变量,但是在也可以在项目根目录创建.env 文件设置环境变量便于使用(建议开发环境使用)

MYSQL_DSN="db_user:db_password@/db_name?charset=utf8&parseTime=True&loc=Local" # Mysql连接语句
REDIS_ADDR="127.0.0.1:6379" # Redis端口地址
REDIS_PW="" # Redis连接密码
REDIS_DB="" # Redis库从0到10
GIN_MODE="debug"#开发模式下使用debug
OSS_END_POINT="oss-cn-shenzhen.aliyuncs.com"#你的仓库所在的阿里云对象存储地域节点
OSS_ACCESS_KEY_ID=""#阿里云RAM访问控制用户ID
OSS_ACCESS_KEY_SECRET=""#阿里云RAM访问控制KEY
OSS_BUCKET=""#阿里云OSS仓库名
GEETEST_ID=""#极验账号对应的ID(需要申请)
GEETEST_KEY=""#极验账号对应的KEY(需要申请)

运行

本项目使用Go Mod管理依赖。

git clone https://github.com/congz666/cmall-go.git
cd cmall-go
go run main.go

项目运行后启动在 3000 端口

cmall-go's People

Contributors

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