Re:Nginx C function
by int0x80 on Sunday October 14, 2018 @07:43AM
(#18212445)
what is the src of the C function?
[ Parent
| on HN ]
Check this file out, it's in the example that's provided:
https://github.com/Taymindis/sample-ngx-cfunc-project/blob/m...
I've stripped out everything of 'getRoute' and only provide a response of a global variable 'thing' that never changes.
std::string thing = "{\"result\": \"Hello World!\"}";
void getRoute(ngx_http_c_func_ctx_t* ctx) {
ngx_http_c_func_write_resp(
ctx,
200,
NULL,
ngx_http_c_func_content_type_json,
::thing.c_str(),
::thing.length()
);
}