Module stardust
create and run an application
Functions
new () | Create a new stardust application. |
use (self, func) | Add middleware to the stack. |
run (self, ngx) | Run the application |
sender (req, res) | Middleware that just calls res:send() |
Fields
VERSION | version |
Functions
- new ()
-
Create a new stardust application.
Returns:
-
stardust
an application
- use (self, func)
-
Add middleware to the stack. Middleware is called in the order it is added. While it is technically possible to add middleware
after the application has started (ie, calling run), this is not supported and may lead to strange results.
Also add middleware before adding routes
Parameters:
- self stardust stardust application
- func function function to call
- run (self, ngx)
-
Run the application
Parameters:
- self stardust stardust application
- ngx ngx magic nginx Lua object
Usage:
Add something like this to nginx.conf: content_by_lua 'return require("my.stardust.module").run(ngx)';
- sender (req, res)
-
Middleware that just calls res:send()
Parameters:
- req stardust.request
- res stardust.response
Usage:
app:use(stardust.sender)