Twitter: raymondcamden


Address: Lafayette, LA, USA

New Project: JavaScript Cookbook

06-10-2013 4,039 views Development 16 Comments

After traveling the last couple of weeks I've got a little break now between conferences and I thought it would be cool to spend some free time on a little project. A few weeks back I purchased javascriptcookbook.com (still can't believe that was available). I'm a huge fan of cookbook-type sites as I find them a much better way to learn about technology than simple "101-style" books. (And I say this as the author of multiple 101-style books.) As I work on client-side development more and more, I find myself hunting down the same type of tricks/techniques/etc multiple times. As an example, "How do I select a random number between two integers?" I figured - why not create a web site so I can collect these things? At worse, I'll learn a few things about Node while I build it, and at best, maybe others will contribute and help build some content. Here is the technology stack I'm using:

Server Side

  • Node.js, with Express. I love how easy it is to quickly set up a simple web site with Node and Express. As I've said before, Express is what made me stop smirking at Node and calling it a "web server builder." To be honest, I could whip up a simple content management site in ColdFusion in 2 hours, but I wouldn't learn anything.
  • hbs is a simple npm module that lets you use Handlebars in your views. All in all it feels a bit like writing simple CFML.
  • MongoDB for data persistence. I haven't used Mongo in years, but it too was rather easy to set up in Node. This article was incredibly helpful and made it simple to learn.

Hosting

I'm not entirely sure yet on this one, but this is what I'm considering...

  • I'm going to start with AppFog, a hosting system that supports Node, Mongo, and other things. They have a free tier I want to play with. Their lowest non-free tier is 20 dollars a month, which is cheap, but as I already pay for hosting, I'm not sure I want to pay more.
  • So if I don't use another host, I may just use this box. I've already learned how to proxy Apache to Node, so all I'd have to do is research how to monitor/launch at boot/relaunch on crash a Node app in Windows.
  • Parse also has Node hosting, and I freaking love Parse. They have a free tier that includes 1 million requests. If you were to get two million your cost would be 70 dollars. Two million hits in a month would be a huge success so I may consider this as well.

Front End

I considered going fancy with Backbone, but frankly, this is an incredibly simple content site, not an "app". I'm using a nice little Bootstrap theme I found and will just do my best to KISS.

I'll also be putting this into a GitHub repo in case anyone wants to see the work behind the scenes, make improvements, or just criticize my Node-code. ;)

Related Blog Entries

16 Comments

  • Commented on 06-10-2013 at 9:36 AM
    Since you're using Node, you should consider looking into CompoundJS, an MVC framework on top of Express. It looks really awesome and has built in ORM functionality.

    http://compoundjs.com/

    My friend Tyson did a presentation on Compound for our local user group and it looks super slick:
    http://slid.es/tysoncadenhead/compoundjs
  • Commented on 06-10-2013 at 9:39 AM
    Will be watching for more articles on this subject - you've peeked my interest now!
  • Commented on 06-10-2013 at 9:58 AM
    @Andy: Honestly, I don't think I need another framework on top of Express. I'm fine with it as is. I may change my mind later on, but for now, I want to minimize the moving parts.

    @Sid: I'll blog as I continue. As soon as I can get the site up on AppFog I'll share the temp URL as well.
  • Nicholas Collins #
    Commented on 06-10-2013 at 10:07 AM
    Hey Ray, by way of anecdote on AppFog, I can't speak to their support for Node.js as I didn't try it. I did, however, sign up and set up a Java server instance (after reading of someone setting up Railo on it) and decided to give it a go to install YouTrack so I could test it out for issue tracking ( LOVE YouTrack BTW ). However, I couldn't even get the WAR to upload fully to test it. There isn't any SSH, so I couldn't tie in and do a WGET from the command line, you are forced to use their Ruby Gem-based tool and API to push your application up, and for me it timed out EVERY time after only a few hundred kb. After spending some time on Google I found that I was not alone and many people have that problem with AppFog and Java. I hope you have more success than that.
  • Commented on 06-10-2013 at 10:13 AM
    Thanks for the warning Nicholas. A coworker of mine has been successful with it so if I run into a problem I'll just bug him. :)
  • Commented on 06-10-2013 at 11:33 AM
    I nearly fell out of my chair when I read javascriptcookbook.com was available. Another good node.js host that a friend uses is https://www.nodejitsu.com
  • Commented on 06-10-2013 at 12:11 PM
    Check out Apigee Usergrid (App Services) for your Cookbook. They are a RESTFUL BAAS like Parse.

    They have SKDs for Node, Javascript, IOS and Android. I use it with Flex and really love it.

    https://developers.apigee.com/app-services
  • Jack #
    Commented on 06-10-2013 at 12:43 PM
    I think it became your responsibility to create the site once you found that javascriptcookbook.com was available! :)

    --J
  • John Ceci #
    Commented on 06-10-2013 at 1:58 PM
    I would second nodejutsu.com...when I had the free time to be messing with Node they worked very nicely...Can't wait to see what you post and the behind the scenes workings on the site...
  • Commented on 06-10-2013 at 2:00 PM
    I've got a github repo open now. Will push once I get off the vpn:

    https://github.com/cfjedimaster/javascriptcookbook...

    For those who recommended nodejutsu - I've seen that before and it does look cool. But I'm pretty set on AppFog. I want to try it at least once. To be clear, that's not the permanent home, just the initial location.
  • Commented on 06-10-2013 at 3:29 PM
    I'm not really ready to talk about it yet - it is still messy, but the GitHub URL above now has crap in it. To Do before first release - proper edit/delete for articles. Need to hide this behind an admin login too.
  • John Ceci #
    Commented on 06-10-2013 at 3:40 PM
    Not sure if it is intentional or not but the repository you created is locked right now...
  • Commented on 06-10-2013 at 3:48 PM
    Sorry, fixed now.
  • Commented on 06-10-2013 at 5:22 PM
    Commits now include an 'admin' secured login. Plus other crap. It is almost to the point where I can blog about the code (as a first draft of course).
  • Commented on 06-11-2013 at 10:08 PM
    Ok, it's now done except for Search. I got email hooked up via gmail. Once I get search in I'll then move on to the AppFog test.
  • Commented on 06-12-2013 at 5:13 PM
    Holy shit. AppFog... AppFog had me up and running in 5 minutes. I didn't have to change ONE DAMN LINE OF CODE. Sorry for ranting. I can't believe it just worked. Hell, my app is still using port 3000, yet its running on 80 from here:

    http://javascriptcookbook.aws.af.cm/

Post Reply

Please refrain from posting large blocks of code as a comment. Use Pastebin or Gists instead. Text wrapped in asterisks (*) will be bold and text wrapped in underscores (_) will be italicized.

Leave this field empty