Skip to content


Adding r.js support #67

wants to merge 6 commits into from

2 participants


Hey Thomas,

in your intro you recommend r.js but don't exactly use it for the examples - at least not in the modular-backbone one. So I decided to try learn how it works using that example. After several failed attempts to configure it I finally got it working (prompting this pull request) but I'd like to get your opinion on my approach. I think there could be a better way but I don't know enough syntax for r.js - perhaps you do.

Ideally, when I build this project, I'd like the final main-built js file to appear in a separate directory with a new index.html which would use it. This separate directory would also have the supporting images and css folders. Instead of a separate directory, I ended with a simply main-built.js file and then I manually had to create a index-prod.html file to use and all this source is in the same "modular-backbone" directory.

How would one setup the build.js to produce this file structure within a new "app-built" directory? And give us a structure something like this:

| index.html
|| scripts
||| main-built.js
|| css
||| style.css
|| imgs

or what would you recommend?


Hey Brandon, bit stressed for time right now so will come back to this in a few days.

In the mean time here are two examples

Neither of them are as elegant as I'd like but I will work with you here to get something beautiful.

@headwinds headwinds an update to the nodejs-mongodb-mongoose-restify demo that actually w…
…orks against the local host from one server but obviously needs to be split into two for deployment

feeling less stressed these days? I hope so... because I have some stuff for to review - much more than r.js support

I have another pull request as I re-worked this:

I think I made it a bit more approachable for someone new to these concepts and focussed on getting it work locally.

I'd really like your input because the next step is to get it to work on a hosted platform - ideally Nodejitsu - where you have your other tutorials.

My local version has 1 server file - see server.js - which contains both a http server and a mongo server listening on two different ports. It works perfectly. You can start up mongodb locally; create a messages collection; and start sending and receiving messages.

Then, for my nodejitsu attempt, I decided to break that file into two distinct apps (see server-http.js and server-mongo.js); inspired by one of your cryptic comments ;-D I have a http app that serves up the html/js/css to the browser and another app that deals with mongo. In my logs, I can see that the two apps are talking to each other - receiving the messages - but they aren't getting saved and returned from mongohq.

Anyways, please pull and poke around a bit -- I'm confident that the local version will be helpful and it shouldn't take much more effort to get the nodejitsu version rocking too.


Hey, looking good. I've added you as a collaborator so you can just push when you see fit in the future.

Running a version up now.

I've got a full site re-work planned for the very near future too.


awesome thanks! I'm going to review that update on the weekend again as I made a lot more progress since that post - I also want to explore a few more ways to use Restify and Mongoose - I'll try to commit it on sunday.

I actually like the existing site ;-D -- your time might be better spent on a little retro fitting instead of a complete overhaul


I've made my commit and it looks like they landed here ok - I'm going to delete my forked repo and do some more testing tomorrow. Along with a couple mongoose updates, I've just added yeoman support ( I was using MAMP ) which gives one live reload. This basically eliminates the need for a local static http server but of course you may still one when you go to host it remotely so I've left it in just in case it becomes necessary.

@headwinds headwinds closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Dec 1, 2012
  1. @headwinds
  2. @headwinds

    updated about

    headwinds committed
  3. @headwinds

    massaging the copy a bit

    headwinds committed
  4. @headwinds
Commits on Apr 5, 2013
  1. @headwinds

    an update to the nodejs-mongodb-mongoose-restify demo that actually w…

    headwinds committed
    …orks against the local host from one server but obviously needs to be split into two for deployment
Commits on Apr 6, 2013
  1. @headwinds
Something went wrong with that request. Please try again.