Skip to content

Commit

Permalink
docs: improve quick start doc (#364)
Browse files Browse the repository at this point in the history
doc: improve quick start doc
  • Loading branch information
sysulq committed Aug 11, 2022
1 parent d52d411 commit 5e45b93
Showing 1 changed file with 11 additions and 47 deletions.
58 changes: 11 additions & 47 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
![](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)
[![go.dev reference](https://img.shields.io/badge/go.dev-reference-007d9c?logo=go&logoColor=white&style=flat-square)](https://pkg.go.dev/github.com/douyu/jupiter?tab=doc)
[![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).
Expand All @@ -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)
Expand Down

0 comments on commit 5e45b93

Please sign in to comment.