The road to Node(JS)
I started learning Node maybe a year and a half ago. I was really, really bad at it when I started. I'm no expert now, but I'm a lot less bad than I used to be 🙂. But I told myself early on that I wanted to take it seriously, and that's why I saved the source code for the first app I ever made in Node. In fact, I plan to keep it going as an ongoing project.
My first NodeJS project was a command line weather app, similar to the beginner level projects a lot of people make..
A few months later, I looked back on my code and realized it was pretty basic. So I started adding some features. I gave it an option to show weather for the whole week, and a "Will it rain?" flag. I also added color to the output, and gave it a nice format.
Then I hit a weird roadblock. Like most people, I almost never read the terms and conditions before I click agree. I know I should, but I just don't. The data returned by my app is handled by Dark Sky, an insanely detailed weather service. I can't remember why, but I found myself reading their terms one day and realized that you can't require users to register their own API key - keys should be used on a per application basis.
So I had two options - either take down the app forever, or create a way to use it without exposing my key 🤔.
Okay, I took it down for a bit. But only because I didn't know how to handle the API call out-of-the-box without exposing the key (spoiler alert: you can't - at least not how I thought).
I started looking around at other weather apps and found someone hosting weather services somewhere on their own server. Interesting. I'm obviously not going to set up a network of sensors, so how can I run a weather service? What if I just run an app that keeps the API key, listens for connections, and forwards a request to Dark Sky with that key appended?
So that's what I did. In fact, the weather app I wrote is now totally functional from the moment you download it. I still need to write some kind of authentication, but it works 🎉.
Continuing development on the first Node app I ever wrote is an experiment I hope to keep up. I'll post more updates as features are added, but for now, check out the sweet project page I created 😎.