Mercurial > hg > nginx-site
comparison xml/en/docs/njs/node_modules.xml @ 2489:bda080989b6c
Fixed indentation and braces in njs example.
author | Vladimir Homutov <vl@nginx.com> |
---|---|
date | Wed, 22 Jan 2020 13:10:07 +0300 |
parents | 8ed243471444 |
children | 4c8d0b37932d |
comparison
equal
deleted
inserted
replaced
2488:6ff92c65df94 | 2489:bda080989b6c |
---|---|
410 | 410 |
411 // invoke protobufjs to decode message | 411 // invoke protobufjs to decode message |
412 var response = pb.helloworld.HelloReply.decode(bytes); | 412 var response = pb.helloworld.HelloReply.decode(bytes); |
413 | 413 |
414 console.log('Reply is:' + response.message); | 414 console.log('Reply is:' + response.message); |
415 } | |
415 </example> | 416 </example> |
416 </para> | 417 </para> |
417 | 418 |
418 </section> | 419 </section> |
419 | 420 |
495 that stores our code: | 496 that stores our code: |
496 | 497 |
497 <example> | 498 <example> |
498 function set_buffer(dnsPacket) | 499 function set_buffer(dnsPacket) |
499 { | 500 { |
500 // create DNS packet bytes | 501 // create DNS packet bytes |
501 var buf = dnsPacket.encode({ | 502 var buf = dnsPacket.encode({ |
502 type: 'query', | 503 type: 'query', |
503 id: 1, | 504 id: 1, |
504 flags: dnsPacket.RECURSION_DESIRED, | 505 flags: dnsPacket.RECURSION_DESIRED, |
505 questions: [{ | 506 questions: [{ |
506 type: 'A', | 507 type: 'A', |
507 name: 'google.com' | 508 name: 'google.com' |
508 }] | 509 }] |
509 }) | 510 }) |
510 | 511 |
511 return buf; | 512 return buf; |
512 } | 513 } |
513 </example> | 514 </example> |
514 | 515 |
515 Note that in this example generated code is not wrapped into function and we | 516 Note that in this example generated code is not wrapped into function and we |
516 do not need to call it explicitly. | 517 do not need to call it explicitly. |