|
About the web framework for OpenResty, I also have one used in my company for two years, you could check the https://github.com/kurapica/PLoop/blob/master/Docs/020.web.md if the example interest you: ``` -- The MVC Controller class "FileController" (function(_ENV)) inherit "Controller" local yield = coroutine.yield
__Action__("download", HttpMethod.GET) -- GET /file/download __File__() -- Send the downloaded file as response __Iterator__() -- An iterator that use yied to return values as the download contents function download(self, context) yield("test.csv") -- The first yield value as the file name -- The download contents will be sent as stream yield("col1, col2, col3\n") for i = 1, 10 do for j = 1, 3 do yield(i * 10 + j) yield(",") end yield("\n") end end end)``` |