Skip to content

Commit

Permalink
update README
Browse files Browse the repository at this point in the history
  • Loading branch information
zhufuyi committed Oct 21, 2024
1 parent 728979c commit f926698
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 10 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

**Sponge** is a powerful development framework that integrates `automatic code generation`, `Gin and GRPC`. Sponge has a rich set of code generation commands, and the generated different functional codes can be combined into a complete service (similar to how artificially broken sponge cells can automatically reassemble into a new complete sponge). Sponge provides one-stop project development (code generation, development, testing, api documentation, deployment), it greatly improves development efficiency and reduces development difficulty, develop high-quality projects with a "low code approach".

Sponge is used to quickly and efficiently develop high-performance back-end services for various application scenarios and requirements, including `web` services, `gRPC` services, `http+gRPC` hybrid services, `gRPC gateway API` services.

<br>

### Sponge Core Design Philosophy
Expand Down Expand Up @@ -94,6 +96,7 @@ Click to view the [**test code**](https://github.com/zhufuyi/microservices_frame
- Resource statistics [gopsutil](https://github.com/shirou/gopsutil)
- Code quality checking [golangci-lint](https://github.com/golangci/golangci-lint)
- Continuous integration and deployment [jenkins](https://github.com/jenkinsci/jenkins), [docker](https://www.docker.com/), [kubernetes](https://github.com/kubernetes/kubernetes)
- Generate project business architecture diagram, [example](https://github.com/zhufuyi/sponge_examples/blob/main/assets/eshop-business-architecture-diagram.svg).

<br>

Expand Down
3 changes: 3 additions & 0 deletions assets/readme-cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

[sponge](https://github.com/zhufuyi/sponge) 是一个集成了 `自动生成代码``Gin和GRPC` 的强大的开发框架。sponge拥有丰富的生成代码命令,生成不同的功能代码可以组合成完整的服务(类似人为打散的海绵细胞可以自动重组成一个新的海绵)。sponge提供了一站式项目开发(生成代码、开发、测试、api文档、部署),大幅提高了开发效率和降低了开发难度,以"低代码方式"开发高质量项目。

sponge 用来快速高效开发各种应用场景和需求的高性能后端服务,包括 `web` 服务、`gRPC` 服务、`http+gRPC` 混合服务、 `gRPC网关API`服务等。

<br>

### sponge 核心设计理念
Expand Down Expand Up @@ -81,6 +83,7 @@ sponge包含丰富的组件(按需使用):
- 资源统计 [gopsutil](https://github.com/shirou/gopsutil)
- 代码质量检查 [golangci-lint](https://github.com/golangci/golangci-lint)
- 持续集成部署 CICD [jenkins](https://github.com/jenkinsci/jenkins), [docker](https://www.docker.com/), [kubernetes](https://github.com/kubernetes/kubernetes)
- 生成项目业务架构图,[示例](https://github.com/zhufuyi/sponge_examples/blob/main/assets/eshop-business-architecture-diagram.svg)

<br>

Expand Down
14 changes: 8 additions & 6 deletions internal/routers/routers.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func NewRouter() *gin.Engine {
middleware.WithIgnoreRoutes("/metrics"), // ignore path
))

// init jwt middleware
// init jwt middleware, you can replace it with your own jwt middleware
jwt.Init(
//jwt.WithExpire(time.Hour*24),
//jwt.WithSigningKey("123456"),
Expand Down Expand Up @@ -94,12 +94,14 @@ func NewRouter() *gin.Engine {
r.GET("/health", handlerfunc.CheckHealth)
r.GET("/ping", handlerfunc.Ping)
r.GET("/codes", handlerfunc.ListCodes)
r.GET("/config", gin.WrapF(errcode.ShowConfig([]byte(config.Show()))))

// register swagger routes, generate code via swag init
docs.SwaggerInfo.BasePath = ""
// access path /swagger/index.html
r.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerFiles.Handler))
if config.Get().App.Env != "prod" {
r.GET("/config", gin.WrapF(errcode.ShowConfig([]byte(config.Show()))))
// register swagger routes, generate code via swag init
docs.SwaggerInfo.BasePath = ""
// access path /swagger/index.html
r.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerFiles.Handler))
}

// register routers, middleware support
registerRouters(r, "/api/v1", apiV1RouterFns)
Expand Down
10 changes: 6 additions & 4 deletions internal/routers/routers_pbExample.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func NewRouter_pbExample() *gin.Engine { //nolint
middleware.WithIgnoreRoutes("/metrics"), // ignore path
))

// init jwt middleware
// init jwt middleware, you can replace it with your own jwt middleware
jwt.Init(
//jwt.WithExpire(time.Hour*24),
//jwt.WithSigningKey("123456"),
Expand Down Expand Up @@ -98,10 +98,12 @@ func NewRouter_pbExample() *gin.Engine { //nolint
r.GET("/health", handlerfunc.CheckHealth)
r.GET("/ping", handlerfunc.Ping)
r.GET("/codes", handlerfunc.ListCodes)
r.GET("/config", gin.WrapF(errcode.ShowConfig([]byte(config.Show()))))

// access path /apis/swagger/index.html
swagger.CustomRouter(r, "apis", docs.ApiDocs)
if config.Get().App.Env != "prod" {
r.GET("/config", gin.WrapF(errcode.ShowConfig([]byte(config.Show()))))
// access path /apis/swagger/index.html
swagger.CustomRouter(r, "apis", docs.ApiDocs)
}

c := newMiddlewareConfig()

Expand Down

0 comments on commit f926698

Please sign in to comment.