Is any documentation to write custom application handler (module) ? #1102
Replies: 2 comments
-
Hi,
No documentation as such...
A lot of the heavy lifting is taken care of for you, your main tasks of concern are handling the request and sending the response.
Here is an example skeleton module. See this commit for how it hooks into the Unit core. That's enough to build the module and load it. For a real module, our WebAssembly module is perhaps the clearest to see how it works. nxt_wasm.[ch] are the main interface to Unit, handling module loading/setup and requests/responses. For the configuration, this commit shows how it's hooked up to the Unit configuration infrastructure. Then here we get a pointer to the config data setup in that last commit. Then a few lines down we can simply access them as in this case they are largely const char *'s. You can see the structure member names match up with what's in the above commit. This also contains a description of some of the API used. |
Beta Was this translation helpful? Give feedback.
-
Thank you Andrew for your quick response. |
Beta Was this translation helpful? Give feedback.
-
Hello Nginx Unit development team.
Nginx Unit great platform for serverless applications. However, it looks as good platform for native programming languages which hard to port to Nginx Server due to internal API complexity.
I'm looking for any documentation to build additional module for currently unsupported frameworks.
Looking into Python/Perl/Ruby modules I see I can register custom module dynamically. However, handling module configuration, http requests and returning http responses by app require researching source code deeply.
I would appreciate it if you can point me any design guidelines and/or module API descriptions.
Beta Was this translation helpful? Give feedback.
All reactions