3 ms·
I don't think it is at all possible to use nginx to write application logic otherwise than serving static files and perhaps doing some URL transformations. node
by fpereiro 7y ago
I don't think it is at all possible to use nginx to write application logic otherwise than serving static files and perhaps doing some URL transformations. node gives you a full programming language that's necessary for implementing an API.
- a_imho 7y agoIt is absolutely possible, that is what the OpenResty stands for.
- fpereiro 7y agoI stand corrected, you're right! I hadn't heard about OpenResty. It's amazing that this exists, I would have never thought it possible (because of what I saw as inherent limits in what can be expressed in terms of nginx configuration), but now that I see it, of course it is :). From what I gather, custom code can be written as Lua scripts, and many of the modules are written in Lua themselves. Thank you for sharing this!
- a_imho 7y agoAs far as I remember Lua scripting is brought by the lua-ngx module, but it is also possible to use JS or the JVM (ngx-clojure) for location handler, or even write your own nginx module in C, nevertheless Lua is the first class citizen. I personally don't mind it, but obviously the ecosystem and the market for Lua is much smaller than JS. In fact, I'm only aware of itch.io that runs on OpenResty.
- fpereiro 7y agoIt looks like Lua is the main scripting language; which is a fine choice by me; the few times I worked on redis transaction scripting in Lua (since Lua is the language for doing that) the experience was very pleasant. Are you building a project (or projects) on OpenResty?