23 Video Tutorial How the Excellent 'Luarestyrequests' of Luaresty Were Written

23 Video Tutorial- How the Excellent ’luarestyrequests’ of luaresty Were Written #

Hello, I’m Wen Ming.

Today’s content will also be presented in the form of a video. As usual, before you start learning from the video, let me ask you a few questions:

  • When faced with multiple lua-resty libraries with similar functionality, what aspects should we consider in choosing one?
  • How should we organize the structure of a lua-resty project?

These questions are the core content that this video lesson will address. I hope you can think about them first and come to this video lesson with your questions.

At the same time, I will provide corresponding written descriptions to help you summarize and review the content after watching the video. Below is the written introduction for today’s lesson.

Today’s Core #

The lua-resty libraries we introduced earlier are all officially provided, but there is no official library for the most commonly used HTTP client. In this case, we need to choose an excellent third-party library ourselves.

So how do we choose the best and most suitable third-party library from the many lua-resty HTTP clients available?

At this point, you need to consider factors such as activity, author, test coverage, and interface encapsulation. The one I ultimately chose is lua-resty-requests (https://github.com/tokers/lua-resty-requests). It was contributed by a engineer named tokers from Upyun, and I personally really like its interface style. I also recommend it to you.

In the video, I will start with the simplest “get” interface and gradually expand it, combining the documentation, test cases, and source code. You can see how an excellent lua-resty library is written and what parts can be learned from.

Courseware Reference #

Today’s courseware has been uploaded to my GitHub, and you can download it to study on your own.

Here is the link: https://github.com/iresty/geektime-slides

If there is anything unclear, you can ask questions in the comment section, and you can also share your learning experience in the comment section. Looking forward to our conversation, and feel free to share this article with your colleagues and friends. Let’s communicate and progress together.