Yesterday, I hit a frustrating point in the making of CrowdNotes: I didn’t know how to continue.
I wanted to take values from my mongoDB database and insert them to the HTML as a select box. (To clarify: Let’s say there are several registered events, and I’ve written a note for the event. I should be able to select which event I’m writing the note for, no?)
But, despite my amazing progress, there was no obvious or appropriate way to do that with my still-limited understanding.
So off I went to the Internet, asking folks on IRC (which, fair warning: if you don’t take the time - ie lurk - to answer anyone else’s questions, they will start to notice and not answer yours) and googling every combination of words to find something that might possibly help me out. And then I came upon this tutorial: Blog rolling with mongodb, express and Node.js. Perfect much? Yeah, pretty much.
No, the tutorial doesn’t cover my exact question. But it was exactly what I needed for getting started on the path I needed to take to answer it! To some, the result might appear unacceptable: it was time to set aside everything I’d done so far and start anew.
What?! Start over?! No, not start over. Move forward.
As engineer, I have become acutely aware of the path one takes to travel from an idea to a final product. You start out well-intentioned, and then you realize that you’ve made a wrong turn somewhere and need to head back. But just because you made a left turn at Albuquerque doesn’t mean you wasted your entire trip!
So what do you do? Pick up your things and go!
Here’s what I did: I did the entire tutorial. It brought me through everything I needed to understand Express, a Node.js web development framework that saves a LOT of time; Stylus, a SASS-like CSS styling language; and Jade, a haml-like HTML templating engine. These are, quite frankly, awesome tools that every Node.js app should (and honestly, probably already does) use.
And then I made a new working directory called CNexpress, wherein I made some serious adjustments. I’m still working out all the nuances of working with Express and Jade (I’ll get to Stylus when I’m ready to make things pretty), but the power I feel in my hands has seriously grown by about 1000%!
Here’s the important part: I had heard about Express and Jade a week ago when I had first learned about Node.js. But as per my post about shortcuts, I wanted to make sure I understood what was going on underneath the hood before I dove into all these fancy modules.
I’m happy to say that I made the transition at just the right time :-)
The updated CrowdNotes code has not yet been uploaded to GitHub, but I’ll be happy to do so as a new branch as soon as I have a moment!