I'm try to pull data from a restful service like say twitter. I've done this before in the client with success. Now I'm trying to do it on the server, I can't seem to get backbone to load properly. When I require("backbone") and the file loads, "this" is the module but from the notes on line 15 of backbone.js, its expecting it too be "global" Is there a special way to load this file that puts the global ref in "this"
Here is comments from backbone.js file (line 13-15)
// Save a reference to the global object (`window` in the browser, `global`
// on the server).
var root = this;
But like I said before, it aint 'global', its just an empty [Object]. So, I see at least two possibilities.
Is #1 possible? Am I missing some possibilities?
thx, Dan
Did you install backbone like this:
npm install backbone
I fixed this by using setDomLibrary function.
Backbone.setDomLibrary(require('jquery'));