一组用于构建api网关的实用程序。
blackgate的Python项目详细描述
Blackgate是一个API网关应用程序。它是无状态的,可扩展的。
通过PIP安装
运行:
$ pip install blackgate
或:
$ git clone git@github.com:soasme/blackgate.git $ cd blackgate $ python setup.py install
通过Docker安装
运行:
$ docker pull soasme/blackgate
示例
配置上游
最小的Blackgate配置如下:
--- proxies: - name: github upstream_url: 'https://api.github.com' request_path_regex: /github/(.*) request_path_sub: /\1
只需将其保存为blackgate.yml。
运行应用程序
运行应用程序:
$ blackgate -c ./blackgate.yml start
或通过Docker:
$ docker run -it --rm --name blackgate \ -p 9654:9654 \ -v blackgate.yml:/etc/blackgate.yml blackgate:latest
测试黑门
使用curl测试功能:
$ curl http://127.0.0.1:9654/github/repos/soasme/blackgate {"id":59739087,"name":"blackgate","full_name":"soasme/blackgate", ...