gateway-golangGolang 版本 API 网关
Go 语言实现 API 网关基础功能。(主要看重 Go 并发处理能力)
获取代码
go get -u github.com/wisrc/gateway
日志框架使用了 golang.org/x/sys 中的包,如果出现下载这个包超时的情况,请到 github.com/golang/sys 中下载,然后将 github.com/golang/sys 重命名为 golang.org/x/sys
配置介绍
- 获取 Eureka 注册中心微服务信息
 - 转发前端请求到后台微服务
 
# 路由配置
```
server:
    port: 8790
    contextPath: /
    timeout: 10
    host:
registerCenter:
    refreshFrequency: 30
    eureka:
        serviceUrls: [ http://localhost:8761 ]
router:
    gateway:
        ignoredPatterns: [ /gateway, /js, /css ]
        sensitiveHeaders: [Cookie]
        routers:
            user:
                path: /map/**
                serviceId: map
                stripPrefix: true
                timeout: 30
            ai:
                path: /gitchat/**
                url: https://gitbook.cn
                stripPrefix: false
                timeout: 5
``` 
测试地址
http://localhost:8790/gitchat/columns/category/5d8b7c3786194a1921979123?page=1
性能测试
评论
