Welcome to Node.js: Part 5 – Progress, REST, Repeat

July 15, 2014

In high school, I remember sewing together a pair of shorts, and then making a pillow. This was, of course, in Home Ec. In “computer” class, I learned that left-click selects things, right-click usually opens up options, the Work_in_progressstandard keyboard arrangement is called QWERTY, and power point can be used to tell humorous epics frowned upon by the school board. I’m just old enough to remember the Internet’s big arrival in grade school. ($500 for an Encarta subscription, anyone? And half an hour to open it?) I know enough now to wish I would have traded most of my time in school for learning about computers in some meaningful way more than just Word and Excel.

Now the Internet is awesome, most information can be found for free, and I can type without looking at my fingers. Progress. From here on out, I’m assuming you’re running through Christopher Buecheler’s incredibly useful second tutorial, too. Was I able to follow through without any problems?

Nope. But it’s not him, it’s me. Rather, some of it stems from using different systems. Maybe. Probably. I think. Like I mentioned at the end of the previous post, Mr. Buecheler reviews the meaning of REST (REpresentational State Transfer) in Part 1 of his guide to building a simple REST-ful web app. I had no problem following through Parts 2 and 3, either—they’re pretty much straight forward and don’t require any complex manipulations.

I ran into problems in Parts 4 and 5, and I wasn’t sure where. I skipped the first two instructions of Part 4 because it’s essentially the same problem I ran into in the last tutorial. No biggie, right? Just skip and march on. Proceed forth, yearling programmer. I tried over and over to change bits and pieces of various instructions, but ultimately wasted most of a day. Eventually, starting over completely, I investigated where exactly the MongoDB install had put it’s data, what happened during the install, and how to do something on Ubuntu similar to what was supposed to happen in Windows.

What I think of every time I hear the word "daemon"

What I think of every time I hear the word “daemon”

So, to clear up the problem I ran into in the last post and this one, if you’re installing MongoDB on Ubuntu, it’s going to start an instance of the mongo daemon right off the bat. No, I’m not entirely (remotely) sure what a daemon is—according to Dr. Google, “A daemon is a long-running background process that answers requests for services.”—but apparently it’s important. For reasons I’m not aware of, this was permissible in completing Buecheler’s first tutorial, but screwed something up in this second tutorial. In either case, stopping it is easy. Enter the command below, and it stops.

Killing Mongo


Then, to follow the Ubuntu parallel of Buecheler’s instructions at the start of Part 4, cd into var/lib/mongodb, and enter “mongod –dbpath ~/node/nodetest2/data”—this is if you left the mongodb install where it put itself, and other than that you’ve been following his previous instructions on what to call things and where to put them. This command will leave a new daemon running connected between your project and data, which is where I kept running into problems.

Then, I pretty much returned to following Buecheler’s instructions, and the empty table in the browser finally populated with the manually entered data. From there, I followed along ’til the end of the tutorial. Thank you Mister Buecheler. You are a scholar and a gentleman.

Serendipitously, Buecheler leaves off with an invitation to create, on our own, an updating function on the rudimentary web app we had set up. It doesn’t look like it would be too difficult, but we know me, so… We’ll tackle that in the next post.

Nate Aeilts

Nate Aeilts is currently enrolled in an internship program at MPA. Nate is a student at Taylor University, and enjoys learning about programming and new tech tools. He likes dogs and chocolate, though he acknowledges they do not mix well.

Post your comment