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 Node.js Basics 2017 Create a Command Line Weather Application Parsing Data and Printing - Solution

Error: connect ETIMEDOUT

I've been having a lot of issues with this final piece. I tried to write my own to know avail so I ended up watching and copying what Andrew did unfortunately I'm getting this:

treehouse:~/workspace$ node app.js 90210                                                                       
      throw er; // Unhandled 'error' event                                                                     

Error: connect ETIMEDOUT                                                                          
    at Object.exports._errnoException (util.js:1022:11)                                                        
    at exports._exceptionWithHostPort (util.js:1045:20)                                                        
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1087:14)   

Weather.JS file

const http = require ('http');
const https = require ('https');
const api = require('./api.json');

function printWeather (weather) {
  const message = `Current temperature in ${weather.location.city} is ${weather.current_observation.temp_f} F`;
//retreive data
function get(query) {
  const request = https.get(`https://api.wundergrund.com/api/${api.key}/geolookup/conditions/q/${query}.json`, response => {
      let body = "";
      response.on('data', chunk => {
        body += chunk;
      response.on('end', () => {
        //Parase data
        const profile = JSON.parse(body);
        //Print the data
        printWeather (weather);
module.exports.get= get;

//TODO: Handle any errors

app.js file:

const weather = require('./weather');
const query = process.argv.slice(2).join("_").replace(' ', '_')

Any help would be greatly appreciated. I've been on the strugglebus all morning over this one.