Fix README file of the blog example. (#842)
parent
2a47af33c0
commit
46acad3400
@ -1,32 +1,18 @@ |
|||||||
# Kratos Layout |
# How to run this blog example server |
||||||
|
1. You should ensure that your mysql server is running. |
||||||
## Install Kratos |
2. Ensure that the database named `testdb` has been created, |
||||||
|
otherwise you should execute the following database script: |
||||||
|
```mysql |
||||||
|
create database testdb; |
||||||
``` |
``` |
||||||
go get github.com/go-kratos/kratos/cmd/kratos |
3. Modify the `configs/config.yaml` file and add your mysql information in the data source: |
||||||
go get github.com/go-kratos/kratos/cmd/protoc-gen-go-http |
```yaml |
||||||
go get github.com/go-kratos/kratos/cmd/protoc-gen-go-errors |
data: |
||||||
|
database: |
||||||
# from source |
driver: mysql |
||||||
cd cmd/kratos && go install |
source: root:password@tcp(127.0.0.1:3306)/testdb?parseTime=True |
||||||
cd cmd/protoc-gen-go-http && go install |
|
||||||
cd cmd/protoc-gen-go-errors && go install |
|
||||||
``` |
|
||||||
## Create a service |
|
||||||
``` |
|
||||||
# create project template |
|
||||||
kratos new blog |
|
||||||
|
|
||||||
cd helloworld |
|
||||||
# download modules |
|
||||||
go mod download |
|
||||||
|
|
||||||
# generate Proto template |
|
||||||
kratos proto add api/blog/blog.proto |
|
||||||
# generate Proto source code |
|
||||||
kratos proto client api/blog/blog.proto |
|
||||||
# generate server template |
|
||||||
kratos proto server api/blog/blog.proto -t internal/service、 |
|
||||||
|
|
||||||
# generate all proto source code, wire, etc. |
|
||||||
go generate ./... |
|
||||||
``` |
``` |
||||||
|
4. Run your blog server: |
||||||
|
```yaml |
||||||
|
make run |
||||||
|
``` |
Loading…
Reference in new issue