JavaScript Callback Example code=yes http://veeryapiperl.soupmode.com/api/posts/profile returned json: {"status":200,"post":{"author":"JohnR","reading_time":0,"created_at":"2015/06/12 14:04:52","html":"

My profile page.

\n\n

Nothing here for now.

\n","updated_at":"2015/09/15 22:51:42","slug":"profile","post_type":"article","word_count":7,"title":"Profile"},"description":"OK"} ========================== // main.js var my_module = require('./module.js'); // pass the id or slug of the web post. // in this example, looking to retrieve the json for my profile page my_module.get_blog_post('profile', function(json_obj) { console.log(json_obj); console.log(json_obj.post.html); }); ===================================== // module.js var http = require('http'); module.exports.get_blog_post = function (page_id, callback) { var options = { host: 'veeryapiperl.soupmode.com', port: 80, path: '/api/posts/' + page_id, method: 'GET' }; http.request(options, function(res) { console.log('STATUS: ' + res.statusCode); res.setEncoding('utf8'); res.on('data', function(chunk) { const json = JSON.parse(chunk); callback(json); }); }).end(); };