OpenResty第三方插件lua-resty-http发送HTTP请求
插件GitHub地址https://github.com/ledgetech/lua-resty-http
将插件的http.lua
http_connect.lua
http_headers.lua
三个文件加入openResty的lualib/resty
目录中
sendHttp.lua
local http = require('resty.http')
local httpObj = http.new()
local res, err = httpObj:request_uri('http://127.0.0.1:5000/students', {
method = 'GET'
})
if not res then
ngx.log(ngx.ERR, "request failed: ", err)
return
end
ngx.say(res.body)
PREVIOUSOpenResty访问Redis
NEXTElement UI使用