comparison xml/en/docs/njs/examples.xml @ 2438:86b0dd6e7208

Updated API version in njs examples.
author Yaroslav Zhuravlev <yar@nginx.com>
date Thu, 03 Oct 2019 13:53:34 +0300
parents aa20cba8027c
children 253641e268a8
comparison
equal deleted inserted replaced
2437:bf8eb55e35dd 2438:86b0dd6e7208
7 <!DOCTYPE article SYSTEM "../../../../dtd/article.dtd"> 7 <!DOCTYPE article SYSTEM "../../../../dtd/article.dtd">
8 8
9 <article name="Examples" 9 <article name="Examples"
10 link="/en/docs/njs/examples.html" 10 link="/en/docs/njs/examples.html"
11 lang="en" 11 lang="en"
12 rev="5"> 12 rev="6">
13 13
14 <section id="helloword" name="Hello World"> 14 <section id="helloword" name="Hello World">
15 15
16 <para> 16 <para>
17 <path>nginx.conf</path>: 17 <path>nginx.conf</path>:
237 237
238 <para> 238 <para>
239 <path>subrequest.js</path>: 239 <path>subrequest.js</path>:
240 <example> 240 <example>
241 function set_keyval(r) { 241 function set_keyval(r) {
242 r.subrequest('/api/3/http/keyvals/foo', 242 r.subrequest('/api/5/http/keyvals/foo',
243 { method: 'POST', 243 { method: 'POST',
244 body: JSON.stringify({ foo: 789, bar: "ss dd 00" })}, 244 body: JSON.stringify({ foo: 789, bar: "ss dd 00" })},
245 245
246 function(res) { 246 function(res) {
247 if (res.status >= 300) { 247 if (res.status >= 300) {
251 r.return(500); 251 r.return(500);
252 }); 252 });
253 } 253 }
254 254
255 function version(r) { 255 function version(r) {
256 r.subrequest('/api/3/nginx', { method: 'GET' }, function(res) { 256 r.subrequest('/api/5/nginx', { method: 'GET' }, function(res) {
257 if (res.status != 200) { 257 if (res.status != 200) {
258 r.return(res.status); 258 r.return(res.status);
259 return; 259 return;
260 } 260 }
261 261