From 5e45b935455191ffefc6a7237a953173c5bad2fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A4=A7=E5=8F=AF?= Date: Thu, 11 Aug 2022 15:26:52 +0800 Subject: [PATCH] docs: improve quick start doc (#364) doc: improve quick start doc --- README.md | 58 +++++++++++-------------------------------------------- 1 file changed, 11 insertions(+), 47 deletions(-) diff --git a/README.md b/README.md index a11ae564bd..124a861e09 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,7 @@ -![](doc/logo.png) + +# JUPITER: Governance-oriented Microservice Framework + +![logo](doc/logo.png) [![GoTest](https://github.com/douyu/jupiter/workflows/Go/badge.svg)](https://github.com/douyu/jupiter/actions) [![codecov](https://codecov.io/gh/douyu/jupiter/branch/master/graph/badge.svg)](https://codecov.io/gh/douyu/jupiter) @@ -6,8 +9,6 @@ [![Go Report Card](https://goreportcard.com/badge/github.com/douyu/jupiter)](https://goreportcard.com/report/github.com/douyu/jupiter) ![license](https://img.shields.io/badge/license-Apache--2.0-green.svg) -# JUPITER: Governance-oriented Microservice Framework - ## Introduction JUPITER is a governance-oriented microservice framework, which is being used for years at [Douyu](https://www.douyu.com). @@ -16,54 +17,17 @@ JUPITER is a governance-oriented microservice framework, which is being used for See the [中文文档](http://jupiter.douyu.com/) for the Chinese documentation. - ## Quick Start -```golang -func main() { - var app jupiter.Application - app.Startup() - app.Serve(startHTTPServer()) - app.Serve(startGRPCServer()) - app.Schedule(startWorker()) -// app.Executor(startXxlJob()) - app.Run() -} - -func startHTTPServer() server.Server { - server := xecho.DefaultConfig().Build() - server.GET("/hello", func(ctx echo.Context) error { - return ctx.JSON(200, "Gopher Wuhan") - }) - return server -} - -func startGRPCServer() server.Server { - server := xgrpc.DefaultConfig().Build() - helloworld.RegisterGreeterServer(server.Server, new(greeter.Greeter)) - return server -} - -func startWorker() worker.Worker { - cron := xcron.DefaultConfig().Build() - cron.Schedule(xcron.Every(time.Second*10), xcron.FuncJob(func() error { - return nil - })) - return cron -} -// 注册xxl定时任务 -/* -func startXxlJob() executor.Executor { - executor := xxl.DefaultConfig().Build() - executor.RegXJob( - NewTest(), - ) - return executor -} -*/ +```bash +go install github.com/douyu/jupiter/cmd/jupiter@latest +jupiter new example-go +cd example-go +jupiter run -c cmd/exampleserver/.jupiter.toml ``` -More Example: +More Example: + - [Quick Start](doc/wiki-cn/quickstart.md) - [Examples](https://github.com/douyu/jupiter-examples) - [Project Layout](https://github.com/douyu/jupiter-layout)