Post

Micro API

micro API

Go API 是基于服务发现驱动开发的可插拔 API 框架,旨在帮助构建强大的 API 网关。

指令

micro api 参数

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
$ micro api -h
NAME:
   micro.exe api - Run the api gateway

USAGE:
   micro.exe api [command options] [arguments...]

OPTIONS:
   --address value    Set the api address e.g 0.0.0.0:8080 [%MICRO_API_ADDRESS%]
   设置网关访问的ip和端口,如设置成0.0.0.0:8080,则可以通过http://127.0.0.1:8080/进行访问,默认为0.0.0.0:8080
   --handler value    Specify the request handler to be used for mapping HTTP requests to services; {api, event, http, rpc} [%MICRO_API_HANDLER%]
   指定映射具体哪种类型的处理程序,可选择{api, event, http, rpc} ,默认是rpc
   --namespace value  Set the namespace used by the API e.g. com.example.api [%MICRO_API_NAMESPACE%]
   指定暴露哪些微服务,通过命名空间匹配,如指定value为`go.micro.srv`,则该空间下所有微服务都能被访问
   --resolver value   Set the hostname resolver used by the API {host, path, grpc} [%MICRO_API_RESOLVER%]
   路径和微服务的对应关系,默认是micro,可选项为{host, path, grpc}
   --enable_rpc       Enable call the backend directly via /rpc [%MICRO_API_ENABLE_RPC%]
   是否支持直接通过rcp接口进行访问,默认false
This post is licensed under CC BY 4.0 by the author.