JavaScript Node.js Basics Create a Command Line Weather Application Retrieving Data - Solution

Trevor Maltbie
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Trevor Maltbie
Full Stack JavaScript Techdegree Graduate 16,967 Points

Two word cities don't work

If I type "node app San Jose, CA" or "node app San Jose" it never works since the city is two words.

I'm confused how to exactly make this work?

2 Answers

Gergely Bocz
MOD
Gergely Bocz
Treehouse Moderator 12,586 Points

Hi Trevor!

As far as i know, there is no way multiple word long file names work, as everything after the first one will be automatically treated an argument. Therefore, the only natural way is to format the filename according to a specific case. The most common suggestion i found is kebab-case, though i got used to snake-case a while back and i think it should work fine. Here is a stackoverflow question about naming conventions. That's all i can help you with, hope it's enough.

Gergely Bocz
MOD
Gergely Bocz
Treehouse Moderator 12,586 Points

Sorry i just realized your question was about multiple word long arguments, and not file names. It's pretty much the same case as file names: You have to compress a multiple word argument into a 1 word argument. Now when retrieveing data from a DB or through an API, you should use their convention. So in this case if api.wunderground's data can be accesed like San_Jose then use that, if it's San-Jose, use that, so on. Unfortunately their services are down atm, so i cannot check their format.