generated from cloudwego/.github
-
Notifications
You must be signed in to change notification settings - Fork 103
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #52 from rogerogers/feat/gomall
feat: add gomall
- Loading branch information
Showing
4,131 changed files
with
327,543 additions
and
10 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,14 @@ | ||
# Typo check: https://github.com/crate-ci/typos | ||
|
||
[files] | ||
extend-exclude = ["go.mod", "go.sum", "hack/*", "check_branch_name.sh", "*/licenses/*"] | ||
extend-exclude = [ | ||
"go.mod", | ||
"go.sum", | ||
"hack/*", | ||
"check_branch_name.sh", | ||
"*/licenses/*", | ||
"bootstrap.*.js", | ||
"go.work.sum" | ||
] | ||
|
||
[default.extend-identifiers] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
.DS_Store | ||
app/cart/.env | ||
app/**/nohup.out | ||
.idea/ | ||
app/**/log/ | ||
app/**/tmp/ | ||
app/**/kitex_gen/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
.PHONY: all | ||
all: help | ||
|
||
default: help | ||
|
||
.PHONY: help | ||
help: ## Display this help. | ||
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z_0-9-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST) | ||
|
||
##@ Initialize Project | ||
.PHONY: init | ||
init: ## Just copy `.env.example` to `.env` with one click, executed once. | ||
@scripts/copy_env.sh | ||
|
||
##@ Build | ||
|
||
.PHONY: gen | ||
gen: ## gen client code of {svc}. example: make gen svc=product | ||
@scripts/gen.sh ${svc} | ||
|
||
.PHONY: gen-client | ||
gen-client: ## gen client code of {svc}. example: make gen svc=product | ||
@cd rpc_gen && cwgo client --type RPC --service ${svc} --module github.com/cloudwego/biz-demo/gomall/rpc_gen -I ../idl --idl ../idl/${svc}.proto | ||
|
||
.PHONY: gen-server | ||
gen-server: ## gen service code of {svc}. example: make gen-server svc=product | ||
@cd app/${svc} && cwgo server --type RPC --service ${svc} --module github.com/cloudwego/biz-demo/gomall/app/${svc} --pass "-use github.com/cloudwego/biz-demo/gomall/rpc_gen/kitex_gen" -I ../../idl --idl ../../idl/${svc}.proto | ||
|
||
.PHONY: gen-checkout-client | ||
gen-checkout-client: | ||
@cd app/frontend && cwgo client -I ../../idl --type RPC --service checkout --module github.com/cloudwego/biz-demo/gomall/app/frontend --idl ../../idl/checkout.proto | ||
|
||
.PHONY: gen-order-client | ||
gen-order-client: | ||
@cd app/frontend && cwgo client -I ../../idl --type RPC --service order --module github.com/cloudwego/biz-demo/gomall/app/frontend --idl ../../idl/order.proto | ||
|
||
.PHONY: gen-frontend | ||
gen-frontend: | ||
@cd app/frontend && cwgo server -I ../../idl --type HTTP --service frontend --module github.com/cloudwego/biz-demo/gomall/app/frontend --idl ../../idl/frontend/checkout_page.proto | ||
|
||
##@ Build | ||
|
||
.PHONY: watch-frontend | ||
watch-frontend: | ||
@cd app/frontend && air | ||
|
||
.PHONY: tidy | ||
tidy: ## run `go mod tidy` for all go module | ||
@scripts/tidy.sh | ||
|
||
.PHONY: lint | ||
lint: ## run `gofmt` for all go module | ||
@gofmt -l -w app | ||
@gofumpt -l -w app | ||
|
||
.PHONY: vet | ||
vet: ## run `go vet` for all go module | ||
@scripts/vet.sh | ||
|
||
.PHONY: lint-fix | ||
lint-fix: ## run `golangci-lint` for all go module | ||
@scripts/fix.sh | ||
|
||
.PHONY: run | ||
run: ## run {svc} server. example: make run svc=product | ||
@scripts/run.sh ${svc} | ||
|
||
##@ Development Env | ||
|
||
.PHONY: env-start | ||
env-start: ## launch all middleware software as the docker | ||
@docker-compose up -d | ||
|
||
.PHONY: env-stop | ||
env-stop: ## stop all docker | ||
@docker-compose down | ||
|
||
.PHONY: clean | ||
clean: ## clern up all the tmp files | ||
@rm -r app/**/log/ app/**/tmp/ | ||
|
||
##@ Open Browser | ||
|
||
.PHONY: open.gomall | ||
open-gomall: ## open `gomall` website in the default browser | ||
@open "http://localhost:8080/" | ||
|
||
.PHONY: open.consul | ||
open-consul: ## open `consul ui` in the default browser | ||
@open "http://localhost:8500/ui/" | ||
|
||
.PHONY: open.jaeger | ||
open-jaeger: ## open `jaeger ui` in the default browser | ||
@open "http://localhost:16686/search" | ||
|
||
.PHONY: open.prometheus | ||
open-prometheus: ## open `prometheus ui` in the default browser | ||
@open "http://localhost:9090" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
# Gomall | ||
[中文](README_cn.md) | ||
|
||
This is a teaching project for newbie using CloudWeGo | ||
|
||
## Technology Stack | ||
| technology | introduce | | ||
|---------------|----| | ||
| cwgo | - | | ||
| kitex | - | | ||
| [bootstrap](https://getbootstrap.com/docs/5.3/getting-started/introduction/) | Bootstrap is a powerful, feature-packed frontend toolkit. Build anything—from prototype to production—in minutes. | | ||
| Hertz | - | | ||
| MySQL | - | | ||
| Redis | - | | ||
| ES | - | | ||
| Prometheus | - | | ||
| Jaeger | - | | ||
| Docker | - | | ||
|
||
|
||
## Biz Logic | ||
- [x] The pages check auth | ||
- [x] Register | ||
- [x] Login | ||
- [x] Logout | ||
- [x] Product categories | ||
- [x] Products | ||
- [x] Add to cart | ||
- [x] The number badge of cart products | ||
- [x] Checkout | ||
- [x] Payment | ||
- [x] Orders center | ||
|
||
## How to use | ||
### Prepare | ||
List required | ||
- Go | ||
- IDE / Code Editor | ||
- Docker | ||
- [cwgo](https://github.com/cloudwego/cwgo) | ||
- kitex `go install github.com/cloudwego/kitex/tool/cmd/kitex@latest` | ||
- [Air](https://github.com/cosmtrek/air) | ||
- ... | ||
|
||
### Clone code | ||
``` | ||
git clone ... | ||
``` | ||
|
||
### Copy `.env` file | ||
``` | ||
make init | ||
``` | ||
*Note:*`You must generate and input SESSION_SECRET random value for session` | ||
|
||
### Download go module | ||
``` | ||
make tidy | ||
``` | ||
|
||
### Start Docker Compose | ||
``` | ||
make env-start | ||
``` | ||
if you want to stop their docker application,you can run `make env-stop`. | ||
|
||
### Run Service | ||
This cmd must appoint a service. | ||
|
||
*Note:* `Run the Go server using air. So it must be installed` | ||
``` | ||
make run svc=`svcName` | ||
``` | ||
### View Gomall Website | ||
``` | ||
make open-gomall | ||
``` | ||
### Check Registry | ||
``` | ||
make open-consul | ||
``` | ||
### Make Usage | ||
``` | ||
make | ||
``` | ||
## Contributors | ||
- [rogerogers](https://github.com/rogerogers) | ||
- [baiyutang](https://github.com/baiyutang) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
# Gomall | ||
[EN](README.md) | ||
|
||
新人学习 CloudWeGo 的教学项目 | ||
|
||
## 技术栈 | ||
| 技术 | 介绍 | | ||
|---------------|----| | ||
| cwgo | - | | ||
| kitex | - | | ||
| [bootstrap](https://getbootstrap.com/docs/5.3/getting-started/introduction/) | Bootstrap is a powerful, feature-packed frontend toolkit. Build anything—from prototype to production—in minutes. | | ||
| Hertz | - | | ||
| MySQL | - | | ||
| Redis | - | | ||
| ES | - | | ||
| Prometheus | - | | ||
| Jaeger | - | | ||
| Docker | - | | ||
|
||
## 业务逻辑 | ||
- [x] 页面访问认证检查 | ||
- [x] 注册 | ||
- [x] 登录 | ||
- [x] 退出 | ||
- [x] 产品分类 | ||
- [x] 产品 | ||
- [x] 加购 | ||
- [x] 购物车数量角标 | ||
- [x] 下单 | ||
- [x] 支付 | ||
- [x] 订单中心 | ||
|
||
## 如何使用 | ||
### 准备 | ||
必备清单 | ||
- Go | ||
- IDE / Code Editor | ||
- Docker | ||
- [cwgo](https://github.com/cloudwego/cwgo) | ||
- kitex `go install github.com/cloudwego/kitex/tool/cmd/kitex@latest` | ||
- [Air](https://github.com/cosmtrek/air) | ||
- ... | ||
|
||
### 克隆项目 | ||
``` | ||
git clone ... | ||
``` | ||
|
||
### 拷贝 `.env` 文件 | ||
``` | ||
make init | ||
``` | ||
*Note:*`必须生成并输入 SESSION_SECRET 值供 session 功能正常使用` | ||
### 下载 Go 依赖 | ||
``` | ||
make tidy | ||
``` | ||
|
||
### 启动容器 | ||
``` | ||
make env-start | ||
``` | ||
if you want to stop their docker application,you can run `make env-stop`. | ||
|
||
### 启动某服务 | ||
该命令必须执行一个服务 | ||
|
||
*注意:* `我们使用 air 运行并热加载,必须先安装好` | ||
``` | ||
make run svc=`svcName` | ||
``` | ||
### 浏览 Gomall 站点 | ||
``` | ||
make open-gomall | ||
``` | ||
### 查看注册中心 | ||
``` | ||
make open-consul | ||
``` | ||
### Make 用法 | ||
``` | ||
make | ||
``` | ||
## 贡献者 | ||
- [rogerogers](https://github.com/rogerogers) | ||
- [baiyutang](https://github.com/baiyutang) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
MYSQL_USER=root | ||
MYSQL_PASSWORD=root | ||
MYSQL_HOST=127.0.0.1 | ||
OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=http://127.0.0.1:4317 | ||
OTEL_EXPORTER_OTLP_INSECURE=true | ||
REGISTRY_ENABLE=true | ||
REGISTRY_ADDR=127.0.0.1:8500 |
Oops, something went wrong.