douyin-mall-go-template
ใStar us and watch this project grow! ๐ฑโญ๏ธใA comprehensive Go e-commerce template project demonstrating best practices in Go web development. Built with Gin framework and MySQL, featuring user authentication, product management, shopping cart, and order processing. Perfect for Go beginners to learn real-world application development.
ํ์ผ ํ์๊ธฐ
- chan-meng-logo.svg
- bug_report.md
- config.yml
- feature_request.md
- FUNDING.yml
- PULL_REQUEST_TEMPLATE.md
- .gitignore
- douyin-mall-go-template.iml
- modules.xml
- health.go
- user.go
- main.go
- config.yaml.example
- Apifox API Testing Tool Guide From Beginner to Practitioner.md
- Apifox ๆฅๅฃๆต่ฏๅทฅๅ ทไฝฟ็จๆๅ.md
- douyin_mall_go_template_ERD.svg
- douyin_mall_go_template_structure_only.sql
- douyin_mall_go_template_with_data.sql
- ไป้ถๅผๅงๅๅปบ็ตๅ็ณป็ปๆฐๆฎๅบ.md
- douyin-mall-go-template้กน็ฎ็ปๆ.md
- vite.svg
- react.svg
- AuthLayout.jsx
- FormInput.jsx
- LoginForm.jsx
- RegisterForm.jsx
- Login.jsx
- Register.jsx
- auth.js
- http.js
- App.css
- App.jsx
- index.css
- main.jsx
- .gitignore
- eslint.config.js
- index.html
- package-lock.json
- package.json
- postcss.config.js
- README.md
- tailwind.config.js
- vite.config.js
- auth.go
- cors.go
- logger.go
- user_dto.go
- user.go
- routes.go
- user_service.go
- app.log
- mysql.go
- logger.go
- jwt.go
- .gitattributes
- .gitignore
- CHANGELOG.md
- CODE_OF_CONDUCT.md
- CONTRIBUTING.md
- go.mod
- go.sum
- GOVERNANCE.md
- LICENSE
- README.md
- README.zh-CN.md
- SECURITY.md
- SUPPORT.md
# CDN์ผ๋ก ์ฌ์ฉํ๊ธฐ
jsDelivrjsDelivr๋ ๊ณต๊ฐ GitHub ๋ฆฌํฌ์งํ ๋ฆฌ๋ฅผ ๋ณ๋ ์ค์ ์์ด CDN์ผ๋ก ์ฆ์ ์๋นํฉ๋๋ค. ๋ฒ์ ๊ณผ ํ์ผ์ ๊ณ ๋ฅด๋ฉด ์นํ์ด์ง์ ๋ฐ๋ก ๋ถ์ผ ์ ์๋ ๋งํฌ์ ์์ ์ฝ๋๊ฐ ๋ง๋ค์ด์ง๋๋ค.
๋ช ๋ น์ด ์ฉ์ด์ง
์ด ๋ฌธ์์์ ์ฌ์ฉ๋ ๋ช ๋ น์ด๋ฅผ ๋ชจ์๋ดค์ต๋๋ค. ๋ฏ์ ๋ช ๋ น์ด๊ฐ ์๋ค๋ฉด ํผ์ณ์ ํ์ธํด๋ณด์ธ์.
docker build
์ค๋ช
๋ณด๊ธฐ โผ
docker build
Build an image from a Dockerfile.
docker build .
Build a Docker image using the Dockerfile in the current directory:
docker build {{github.com/creack/docker-firefox}}
Build a Docker image from a Dockerfile at a specified URL:
docker build {{[-t|--tag]}} {{name:tag}} .
Build a Docker image and tag it:
docker run
์ค๋ช
๋ณด๊ธฐ โผ
docker run
This command is an alias of `docker container run`.
tldr docker container run
View documentation for the original command:
git checkout
์ค๋ช
๋ณด๊ธฐ โผ
git checkout
Checkout a branch or paths to the working tree.
git checkout -b {{branch_name}}
Create and switch to a new branch:
git checkout -b {{branch_name}} {{reference}}
Create and switch to a new branch based on a specific reference (branch, remote/branch, tag are examples of valid references):
git checkout {{branch_name}}
Switch to an existing local branch:
git clone
์ค๋ช
๋ณด๊ธฐ โผ
git clone
Clone an existing repository.
git clone {{remote_repository_location}} {{path/to/directory}}
Clone an existing repository into a new directory (the default directory is the repository name):
git clone --recursive {{remote_repository_location}}
Clone an existing repository and its submodules:
git clone {{[-n|--no-checkout]}} {{remote_repository_location}}
Clone only the `.git` directory of an existing repository:
go build
์ค๋ช
๋ณด๊ธฐ โผ
go build
Compile Go sources.
go build {{path/to/main.go}}
Compile a 'package main' file (output will be the filename without extension):
go build -o {{path/to/binary}} {{path/to/source.go}}
Compile, specifying the output filename:
go build -o {{path/to/binary}} {{path/to/package}}
Compile a package:
go fmt
์ค๋ช
๋ณด๊ธฐ โผ
go fmt
Format Go source files, printing the changed filenames.
Note: `./...` is a Go package pattern understood by Go tooling. It matches the current package and all packages recursively under the current directory.
go fmt
Format Go source files in the current directory:
go fmt {{path/to/package}}
Format a specific Go package in your import path (`$GOPATH/src`):
go fmt {{./...}}
Format the package in the current directory and all subdirectories (note the `...`):
go mod
์ค๋ช
๋ณด๊ธฐ โผ
go mod
Module maintenance.
go mod init {{module_name}}
Initialize new module in current directory:
go mod download
Download modules to local cache:
go mod tidy
Add missing and remove unused modules:
go run
์ค๋ช
๋ณด๊ธฐ โผ
go run
Compile and run Go code without saving a binary.
go run {{path/to/file.go}}
Run a Go file:
go run {{path/to/package}}
Run a main Go package:
go test
์ค๋ช
๋ณด๊ธฐ โผ
go test
Test Go packages (files have to end with `_test.go`).
Note: `./...` is a Go package pattern understood by Go tooling. It matches the current package and all packages recursively under the current directory.
go test
Test the package found in the current directory:
go test -v
[v]erbosely test the package in the current directory:
go test -v ./...
Test the packages in the current directory and all subdirectories:
gofmt
์ค๋ช
๋ณด๊ธฐ โผ
gofmt
Go ์์ค ์ฝ๋๋ฅผ ํฌ๋งทํฉ๋๋ค.
๋ ๋ง์ ์ ๋ณด: <https://pkg.go.dev/cmd/gofmt>.
gofmt {{path/to/source.go}}
ํ์ผ์ ํฌ๋งทํ๊ณ ๊ฒฐ๊ณผ๋ฅผ ์ฝ์์ ํ์:
gofmt -w {{path/to/source.go}}
ํ์ผ์ ํฌ๋งทํ์ฌ ์๋ณธ ํ์ผ์ ๋ฎ์ด์ฐ๊ธฐ:
gofmt -s -w {{path/to/source.go}}
ํ์ผ์ ํฌ๋งทํ๊ณ ์ฝ๋๋ฅผ ๋จ์ํํ ํ ์๋ณธ ํ์ผ์ ๋ฎ์ด์ฐ๊ธฐ:
goimports
์ค๋ช
๋ณด๊ธฐ โผ
goimports
Go ์ธ์ด์ import ์ค์ ์
๋ฐ์ดํธํ์ฌ ๋๋ฝ๋ ํญ๋ชฉ์ ์ถ๊ฐํ๊ณ ์ฐธ์กฐ๋์ง ์์ ํญ๋ชฉ์ ์ ๊ฑฐํฉ๋๋ค.
๋ ๋ง์ ์ ๋ณด: <https://pkg.go.dev/golang.org/x/tools/cmd/goimports>.
goimports {{path/to/file.go}}
์๋ฃ๋ import ์์ค ํ์ผ ํ์:
goimports -w {{path/to/file.go}}
๊ฒฐ๊ณผ๋ฅผ `stdout` ๋์ ์์ค ํ์ผ์ ๋ค์ ์์ฑ:
goimports -w -d {{path/to/file.go}}
์ฐจ์ด์ ์ ํ์ํ๊ณ ๊ฒฐ๊ณผ๋ฅผ ์์ค ํ์ผ์ ๋ค์ ์์ฑ:
golangci-lint
์ค๋ช
๋ณด๊ธฐ โผ
golangci-lint
๋ณ๋ ฌ ์ฒ๋ฆฌ, ์ค๋งํธํ๊ณ ๋น ๋ฅธ Go ๋ฆฐํฐ ์คํ ๋๊ตฌ๋ก ์ฃผ์ IDE์ ํตํฉ๋๋ฉฐ YAML ๊ตฌ์ฑ์ ์ง์ํฉ๋๋ค.
๋ ๋ง์ ์ ๋ณด: <https://golangci-lint.run/welcome/quick-start/>.
golangci-lint run
ํ์ฌ ํด๋์์ ๋ฆฐํฐ ์คํ:
golangci-lint linters
ํ์ฑํ ๋ฐ ๋นํ์ฑํ๋ ๋ฆฐํฐ ๋ชฉ๋ก ํ์ (์ฐธ๊ณ : ๋นํ์ฑํ๋ ๋ฆฐํฐ๋ ๋ง์ง๋ง์ ํ์๋๋ฉฐ, ํ์ฑํ๋ ๋ฆฐํฐ๋ก ์ฐฉ๊ฐํ์ง ๋ง์ธ์):
golangci-lint run {{[-E|--enable]}} {{linter}}
ํน์ ๋ฆฐํฐ๋ฅผ ์ด ์คํ์์ [E]nable:
mysql
์ค๋ช
๋ณด๊ธฐ โผ
mysql
MySQL ๋ช
๋ น์ค ๋๊ตฌ.
๋ ๋ง์ ์ ๋ณด: <https://manned.org/mysql>.
mysql {{database_name}}
๋ฐ์ดํฐ๋ฒ ์ด์ค์ ์ฐ๊ฒฐ:
mysql {{[-u|--user]}} {{user}} {{[-p|--password]}} {{database_name}}
๋ฐ์ดํฐ๋ฒ ์ด์ค์ ์ฐ๊ฒฐํ๊ณ , ๋น๋ฐ๋ฒํธ ์ ๋ ฅ ์์ฒญ:
mysql {{[-h|--host]}} {{database_host}} {{database_name}}
๋ค๋ฅธ ํธ์คํธ์ ๋ฐ์ดํฐ๋ฒ ์ด์ค์ ์ฐ๊ฒฐ:
nano
์ค๋ช
๋ณด๊ธฐ โผ
nano
๋ช
๋ น์ค ํ
์คํธ ํธ์ง๊ธฐ. ํฅ์๋ `Pico` ํด๋ก .
๊ด๋ จ ํญ๋ชฉ: `pico`, `rnano`.
๋ ๋ง์ ์ ๋ณด: <https://nano-editor.org/dist/latest/nano.html>.
nano {{path/to/file1 path/to/file2 ...}}
ํธ์ง๊ธฐ ์์:
nano {{[-I|--ignorercfiles]}}
์ค์ ํ์ผ์ ์ฌ์ฉํ์ง ์๊ณ ํธ์ง๊ธฐ ์์:
nano +{{line}},{{column}} {{path/to/file}}
ํน์ ํ์ผ ์ด๊ธฐ, ์ด์ ํ์ผ์ ๋ซ์ผ๋ฉด ๋ค์ ํ์ผ๋ก ์ด๋:
npm install
์ค๋ช
๋ณด๊ธฐ โผ
npm install
Install Node packages.
npm {{[i|install]}}
Install dependencies listed in `package.json`:
npm {{[i|install]}} {{package_name}}@{{version}}
Download a specific version of a package and add it to the list of dependencies in `package.json`:
npm {{[i|install]}} {{package_name}} {{[-D|--save-dev]}}
Download the latest version of a package and add it to the list of dev dependencies in `package.json`:
npm run
์ค๋ช
๋ณด๊ธฐ โผ
npm run
Run a script.
npm run
List available scripts:
npm run {{script_name}}
Run a script:
npm run {{script_name}} -- {{argument}} {{--option}}
Pass arguments to a script:
