SylviaBABY commented on code in PR #7577: URL: https://github.com/apache/apisix/pull/7577#discussion_r934142122
########## docs/zh/latest/plugins/public-api.md: ########## @@ -0,0 +1,165 @@ +--- +title: public-api +keywords: + - APISIX + - API 网关 + - Public API + - public-api +description: public-api 插件用于通过一个通用的 HTTP API 路由暴露一个 API 端点。 +--- + +<!-- +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +--> + +## 描述 + +`public-api` 插件用于通过一个通用的 HTTP API 路由暴露一个 API 端点。 + +当你使用自定义插件时,你可以使用 `public-api` 插件为特定功能定义一个固定的公共 API。例如,你可以使用 [`jwt-auth`](./jwt-auth.md) 插件创建一个公共 API 端点 `/apisix/plugin/jwt/sign` 用于 JWT 认证。 + +默认情况下,在自定义插件中添加的公共 API 是不公开的,用户需要手动配置一个路由并在上面启用 `public-api` 插件。 + +## 属性 + +| 名称 | 类型 | 必选项 | 默认值 | 描述 | +|------|--------|----------|---------|------------------------------------------------------------| +| uri | string | 否 | "" | 公共 API 的 URI。在设置路由时,使用此属性来配置初始的公共 API URI。 | + +## 启用插件 + +除了 `public-api` 插件,下面的例子也使用了 [`jwt-auth`](./jwt-auth.md) 和 [`key-auth`](./key-auth.md) 插件,详细使用方法请参考它们对应的文档。 Review Comment: ```suggestion 除了 `public-api` 插件,下面的例子也使用了 [`jwt-auth`](./jwt-auth.md) 和 [`key-auth`](./key-auth.md) 插件,详细使用方法请参考各自对应的文档。 ``` ########## docs/zh/latest/plugins/public-api.md: ########## @@ -0,0 +1,165 @@ +--- +title: public-api +keywords: + - APISIX + - API 网关 + - Public API + - public-api +description: public-api 插件用于通过一个通用的 HTTP API 路由暴露一个 API 端点。 +--- + +<!-- +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +--> + +## 描述 + +`public-api` 插件用于通过一个通用的 HTTP API 路由暴露一个 API 端点。 + +当你使用自定义插件时,你可以使用 `public-api` 插件为特定功能定义一个固定的公共 API。例如,你可以使用 [`jwt-auth`](./jwt-auth.md) 插件创建一个公共 API 端点 `/apisix/plugin/jwt/sign` 用于 JWT 认证。 + +默认情况下,在自定义插件中添加的公共 API 是不公开的,用户需要手动配置一个路由并在上面启用 `public-api` 插件。 Review Comment: ```suggestion :::note 注意 默认情况下,在自定义插件中添加的公共 API 是不公开的,用户需要手动配置一个路由并在上面启用 `public-api` 插件。 ::: ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
