Cool, Looking forward to this proposal.
Shall we open a discussion in GitHub for more opinions ? 

Leslie Tsang
leslie.ts...@icloud.com

> On 1 Jan 2022, at 10:28 AM, ZhengSong Tu <tzssanggl...@gmail.com> wrote:
> 
> Good idea, it's important.
> 
> *ZhengSong Tu*
> My GitHub: https://github.com/tzssangglass
> Apache APISIX: https://github.com/apache/apisix
> 
> JunXu Chen <chenju...@apache.org> 于2021年12月31日周五 21:07写道:
>> 
>> Thanks for your awesome proposal.
>> 
>> I think the doc could start from how to deploy the development environment,
>> how to run the example plug-in, how to debug, and then introduce how to
>> call APISIX.core, and link up the whole process.
>> 
>> 
>> On Fri, 31 Dec 2021 at 18:29, tzssangglass <tzssanggl...@apache.org> wrote:
>> 
>>> Hi, community, recently, there has been a growing call from the
>>> community for a detailed tutorial on plugin development[1].
>>> 
>>> Many users of APISIX do not know what the correct way when writing
>>> their own plugins.
>>> 
>>> Now that APISIX has accumulated quite a stable collection of functions
>>> in its core module, I would like to show how to use these functions
>>> through documentation.
>>> 
>>> Here is an example:
>>> 
>>> --------------------------------------
>>> 
>>> ### core.id.get
>>> 
>>> **syntax:** apisix_id = core.id.get()
>>> 
>>> **context:** init, rewrite, access, body_filter, header_filter, log
>>> 
>>> **code example:**
>>> 
>>> ```lua
>>> local core = require "apisix.core"
>>> 
>>> function _M.access(conf, ctx)
>>>    local apisix_id = core.id.get()
>>>    ngx.log(ngx.WARN, "apisix_id: ", apisix_id)
>>> end
>>> 
>>> ```
>>> 
>>> **description:**
>>> 
>>> During the init phase of APISIX, the instance ID will be generated in
>>> the following order:
>>> 
>>> 1. read the instance id from `conf/apisix.uid`, use if present;
>>> 2. read the instance id from `conf/config.yml`, use if present,
>>> configure example:
>>> 
>>>    ```
>>>    apisix:
>>>      id: "your-meaningful-id"
>>>    ```
>>> 
>>> 3. generate a uuid as the instance id.
>>> 
>>> If you want to specify a meaningful id to bind Apache APISIX instance
>>> to your internal system, you can refer to step 2.
>>> 
>>> --------------------------------------
>>> 
>>> 
>>> I hope to achieve the following three objectives with this document
>>> 
>>> 1. to organize the functions of the core module
>>> 2. show more APISIX logic and usage tips in the relevant function
>>> descriptions
>>> 3. become a plugin development manual
>>> 
>>> This will be an ongoing process and I'm happy to get started on it. I
>>> look forward to having more community members join in, it's a great
>>> way to learn about APISIX.
>>> 
>>> link:
>>> [1]: https://github.com/apache/apisix/discussions/5421
>>> 
>>> *ZhengSong Tu*
>>> My GitHub: https://github.com/tzssangglass
>>> Apache APISIX: https://github.com/apache/apisix
>>> 

Reply via email to