NJS - API Calls

naidile.pn naidilepn at gmail.com
Mon Jun 3 18:07:33 UTC 2019


Thanks, I'll check it out. Will get back to you in case of any queries.

Additionally, I would like like to know the performance of NJS as we will
be using this in production,
Which one has more performance - Lua or NJS ?

Please suggest here.


On Mon, Jun 3, 2019 at 11:33 PM Dmitry Volyntsev <xeioex at nginx.com> wrote:

>
>
> On 03.06.2019 20:43, naidile.pn wrote:
> >
> > I want to make a REST API call which is on a different server to fetch a
> > property.
> >
> > And add the property to the request from client and proxy it
>
>
> Currently you can do it using two sublocations with proxy_pass
> directives
> (http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_pass).
>
> --------------------
> function js_content(r) {
>
> r.subrequest("/property", reply => {
>
>     if (reply.status != 200)  { r.return(500, "prop failed"); return; }
>
>     r.subrequest('/backend', res => {
>       ...
>     })
>   })
> }
>
> ------------------
>
> We plan to add a Promise object this year, so in the future it will be
> less cumbersome.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx-devel/attachments/20190603/3140794a/attachment-0001.html>


More information about the nginx-devel mailing list