Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/windfarer/kratos-realworld
https://github.com/windfarer/kratos-realworld
Last synced: 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/windfarer/kratos-realworld
- Owner: Windfarer
- License: mit
- Created: 2022-01-25T16:06:19.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2022-07-25T06:17:46.000Z (over 2 years ago)
- Last Synced: 2024-03-15T14:05:05.771Z (10 months ago)
- Language: Go
- Size: 188 KB
- Stars: 157
- Watchers: 4
- Forks: 29
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Kratos Project Template
## Install Kratos
```
go install github.com/go-kratos/kratos/cmd/kratos/v2@latest
```
## Create a service
```
# Create a template project
kratos new servercd server
# Add a proto template
kratos proto add api/server/server.proto
# Generate the proto code
kratos proto client api/server/server.proto
# Generate the source code of service by proto file
kratos proto server api/server/server.proto -t internal/servicego generate ./...
go build -o ./bin/ ./...
./bin/server -conf ./configs
```
## Generate other auxiliary files by Makefile
```
# Download and update dependencies
make init
# Generate API files (include: pb.go, http, grpc, validate, swagger) by proto file
make api
# Generate all files
make all
```
## Automated Initialization (wire)
```
# install wire
go get github.com/google/wire/cmd/wire# generate wire
cd cmd/server
wire
```## Docker
```bash
# build
docker build -t .# run
docker run --rm -p 8000:8000 -p 9000:9000 -v :/data/conf
```