Google Groups

spine.js concepts, hem server/build, require, FAQ for Windows

webguynow Feb 24, 2012 5:40 PM
Posted in group: Spine
Sorry to jumble all these together. 
I'm finally getting the spine concepts (besides the MVC and obvious) like:
Model (besides being the individual object, serves as a collection also)
Controller (besides the main-Controller, can have 1/Model object)
Controller (as in tasks, does not have to have an existing DOM element to be it's  el:  -any generic div, can work and render can work with the DOM later).   I assume that's how the TaskApp   addOne:  addAll:  work.  and this line:

But I'm weak on the structure and what needs to be specified by  require(...) and where that needs to happen. 
what is the role of  ('lib/setup')  ? 
How should jQuery or $ be defined (when it's needed)  ?

I'm on Windows (Win7) but have so far found my way around node.js, npm, hem, without any add-on Cygwin tools, yet. 
I've gotten comfortable with cake build (after making the necessary minor fixes to Cakefile), and made the guillaume86 changes to resolve and stitch to enable a Windows pathSeparator, allowing hem to work

I note where the main-Controller is created (new): either in the jQuery wrap (html), or in the itself (don't need the jQuery wrap).
I need to use 'npm install' to install my dependencies (wish I had fewer),
And can use 'hem build' to create application.js  or 'hem server', which creates application.js on the fly. 

I can run Todos from the file system, launching a browser with the .html from an editor. 
I don't think I can do that with Contacts and other apps, why? 

What are the differences between Todos and Contacts, as far as all the requires() that are in Todos ??

I'm aware of  module.exports  and making a M or C visible.  I'm assuming any M/C not local has to be brought into scope with require().
What about views ?   are these automatically available and can they be referenced by the template id  ?

Regarding Controllers, is the full arsenal of jQuery available to map events ( using  #id ), etc. ?
Using a Todos example  Task.create(name: @input.val())
  what would a 2 param syntax look like ?  - not sure if I'd need to quote anything or just a JSON syntax ?

I'm mainly on the CS learning curve and trying to get used to it, but have additionally looked at spine.js and all that code. 
I'm trying to mimic some of the Todos functionality;  to start with   events: "submit form": "create"   # but I'm not calling this fx
need to debug
Current issue:  inside my jQuery wrap:       var App = new require("index");   
  brings back an empty object

What is going to be the best way to debug issues ?
spine.js looks like it has a lot of promise, and I hope to master it, as well as give back to the community. 
Suggestions / Tips on usage would be welcome -  And comments / corrections as well.