Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript

I just finished the JavaScript creating a command line app using node.js But don't understand what REST api meansbe

I just finished the JavaScript creating a command line app using node.js But don't understand what REST api means

All I understand is that the https.get requests some data eg the weather the temperature in London.

Then if the response is ok eg 200 then it can be parsed into a Json object giving us keys and value pairs to access..

Is this a REST Api and if so why, and what is a stream Api..

As an aside during the development of the weather app.js I tried to use call backs that return objects and even simple strings but they don't seem to work?

const https = require('https'); //Require http module for status codess const username = "chalkers"; const http = require('http'); function get() { const request = https.get(https://teamtreehouse.com/${username}.json, response=> { let body = ""; response.on('data', (chunk)=> {

 body += chunk.toString();

}); response.on('end', ()=> { result = JSON.parse(body); console.log(result.points.total); let points = result.points.total; return points; });

}); }ng let temp = get(); console.log(temp);

temp is undefined is this the non blocking nature