O'Reilly logo

JavaScript JSON Cookbook by Ray Rischpater

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Issuing a web service request using Node.js

So far, our server doesn't do much in response to a POST request; all it does is say "OK" and return the client's JSON back to the client. Typically, your server will need to do something with the JSON you provide, that is, make a web or database query, for example, or perform a computation. Our example queries the web service JSON endpoint at http://www.aprs.fi/, which lets you see how you can make a server-to-server web service request using Node.js.

Getting ready

If you want to run the example for yourself, you'll first need to go to http://www.aprs.fi, register for an account, and obtain an API key. Follow the links on the page to do this, and substitute your API key for the text "—key-"in the example ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required