Nils ,

Thanks so much for your boilerplate, i'm new to node.js but i've been 
working with backbone, we have the same boilerplate structure and bits of 
code for that matter. 
My question is , i need to share the SAME model of the client. Rather it's 
for extending it or use it as-is. Does that mean that i can just put the 
models directory from the client in the shared and use it from backbone as 
is? 

Also what is your suggestion for generalised SQL driver for node? (lets say 
i want to connect to mysql OR to postreSQL but i don't want 2 . Like PDO in 
php)

Thanks again! would love to keep in touch. I'm adopting your boilerplate. 
P.S. it needs updating (express changed their commands a bit)

Shoshy


On Saturday, June 2, 2012 7:26:55 PM UTC+3, Nils Lattek wrote:
>
> I found it a little difficult to setup a module sharing solution, because 
> of the two different module formats (AMD and CommonJS). Projects such 
> as browserify are awesome, but I wanted to try it with AMD modules.
>
> So after a lot of googling and experimenting I created a small demo 
> project which shows how to share code between backbonejs and nodejs.
> I do not use it to share the complete model, because most db-modules (like 
> sequelizejs or mongoose) in node have their own way of defining models. So 
> you would have to merge the definition code of a backbone model with the 
> one of a mongoose model.
> What I tried to do is share the validation logic between the client and 
> the server. This kind of code can be executed regardless of which model 
> format (backbone, mongoose, sequelize) you are using.
> You could also use it for other kind of modules or to share 
> Constants/enums across the client and server.
>
> The example also shows how to setup mochajs unittesting for these modules.
> There are still some things which could be solved better and I am 
> interested in seeing more examples from other people.
>
> You can find it here:
> https://github.com/NilsLattek/backbone-requirejs-node-boilerplate
>
>
> On Wednesday, May 30, 2012 1:58:46 PM UTC+2, al-Amjad Tawfiq Isstaif wrote:
>>
>> Hello everybody!
>>
>> I'm new to the great world of Node.js and have been playing around with 
>> different modules and frameworks. However, there seems a lot of methods for 
>> sharing server code with the client, and there are no default way for doing 
>> that.
>>
>> I have come across many ideas:
>>
>> express-expose: this is a nice replacement for parsing JSON objects 
>> rendered by the the server.
>> https://github.com/visionmedia/express-expose
>>
>> This article exposes a hack to share backbone models on the Node server, 
>> and they are trying to neat their hack with their Capsule and Thoonk 
>> frameworks:
>>
>> http://andyet.net/blog/2011/feb/15/re-using-backbonejs-models-on-the-server-with-node/
>>
>> Syncrhonizing Backbone model using socket.io
>> https://github.com/scttnlsn/backbone.io
>>
>> DNode and RPC as a method to use server methods on the client and vice 
>> versa
>> https://github.com/substack/dnode
>>
>> I know I've mixed a lot of topics, I thought sharing my confusion would 
>> help to get more clarification, especially that there are a lot of 
>> production projects based on Node, andI think that the community certainly 
>> have reached a good collection of concepts and tools for sharing code 
>> between the server and client. I would be very grateful for sharing your 
>> thoughts about that.
>>
>> Best regards,
>>
>> Amjad
>>
>> *
>> *
>>
>

-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Reply via email to