MicroCommunity: Node.js vs RoR

31 views
Skip to first unread message

Amjad

unread,
May 28, 2012, 9:02:52 AM5/28/12
to microcommunity
I've been playing with Node.js for a while, and it really rocks! I think we should consider writing microcommunity using Node.

I'm trying to give it a shot, let's see if it takes me over:
https://github.com/isstaif/microcommunity/

This is going to be experimental, so I've pushed it to my repos. I'll report my findings after I feel sure about them.

However, even if we switched back to Rails, we will only use Rails as an API, and the rest of our app will be a client-side app using Backbone. We will also need to use Node anyway to manage pushing and real-time notification (and probably a lot of real-time collaboration stuff in the future inshalla), so trying to rewrite our App in Node really worth it.

Don't forget to check this out:
http://wikitechie.net/wiki/Backbone.js

Best regards,

Amjad

Muhammad Al-Syrwan

unread,
May 28, 2012, 11:21:53 AM5/28/12
to microco...@googlegroups.com
I always wanted to write it in Node.js, but i'm afraid that our unsteady strategy doesn't fit with other programmers in the team.

In the end, i agree with you my friend, let's move to node :)

Amjad

unread,
May 28, 2012, 3:37:47 PM5/28/12
to microco...@googlegroups.com
You are right my friend. However our experience with Rails was very good, and we were able to prototype a software and get very good feedback.

We were also able to understand all the difficulties facing Rails so we are entering the world of Node with a good background.

And the most important thing, is that we were also able to make the idea of MicroCommunity more concrete and clear.

For all the reasons above I don't regret the time we spent with Rails :), inshallah we are going to head faster towards our goal this time.

Muhammad Al-Syrwan

unread,
May 28, 2012, 3:49:25 PM5/28/12
to microco...@googlegroups.com
until now Backbone.io is the best to use

https://github.com/scttnlsn/backbone.io

Amjad

unread,
May 28, 2012, 3:51:34 PM5/28/12
to microco...@googlegroups.com
Will check it, thanks dude :)

Muhammad Al-Syrwan

unread,
May 31, 2012, 9:35:18 PM5/31/12
to microco...@googlegroups.com
this also could be interesting 
https://github.com/tblobaum/nodeQuery

Amjad

unread,
May 31, 2012, 10:04:51 PM5/31/12
to microco...@googlegroups.com
Cool!

Muhammad Al-Syrwan

unread,
Jun 2, 2012, 8:46:28 AM6/2/12
to microco...@googlegroups.com
I think we don't need a router 
search engines understand such URLs "https://twitter.com/#!/MhdSyrwan"

Amjad

unread,
Jun 2, 2012, 8:49:59 AM6/2/12
to microco...@googlegroups.com
Contratulations, the default microcommunity repo is ni Node.js.
https://github.com/wikitechie/MicroCommunity

Amjad

unread,
Jun 2, 2012, 8:52:13 AM6/2/12
to microco...@googlegroups.com
I've started to be productive writing Node.js and it is really cool. I'm now sure that we no longer need Rails, and it is safe to use Node.js in production.

Amjad

unread,
Jun 2, 2012, 8:53:32 AM6/2/12
to microco...@googlegroups.com
BTW, We've finished a lot of what we have written in Rails. I'm going to share a screenshots soon :)

Muhammad Al-Syrwan

unread,
Jun 2, 2012, 10:30:53 AM6/2/12
to microco...@googlegroups.com
Great :)

i cloned it then called "npm install " 


when i run "node app.js", it gives me the following error :

HTTPServer.prototype.expose =
          ^
TypeError: Cannot read property 'prototype' of undefined
    at Object.<anonymous> (/home/mhdsyrwan/rails_projects/microcommunity/node_modules/express-expose/lib/express-expose.js:51:11)
    at Module._compile (module.js:446:26)
    at Object..js (module.js:464:10)
    at Module.load (module.js:353:31)
    at Function._load (module.js:311:12)
    at Module.require (module.js:359:17)
    at require (module.js:375:17)
    at Object.<anonymous> (/home/mhdsyrwan/rails_projects/microcommunity/node_modules/express-expose/index.js:2:18)
    at Module._compile (module.js:446:26)
    at Object..js (module.js:464:10)


Is there any thing i've missed about preparing the project ?

Amjad

unread,
Jun 2, 2012, 10:33:55 AM6/2/12
to microco...@googlegroups.com
No it is a problem of me.

Remove the line:
require('express-expose')

Amjad

unread,
Jun 2, 2012, 10:35:54 AM6/2/12
to microco...@googlegroups.com
The problem was that this module is only compatable with pre Express 3.0

I forked it and made it compatable but they haven't accepted my pull request yet. However, I made the code run with no dependency on this module.

Muhammad Al-Syrwan

unread,
Jun 2, 2012, 10:39:48 AM6/2/12
to microco...@googlegroups.com
now it works, but no response :(

Muhammad Al-Syrwan

unread,
Jun 2, 2012, 10:40:23 AM6/2/12
to microco...@googlegroups.com

No data received

Unable to load the webpage because the server sent no data.

Amjad

unread,
Jun 2, 2012, 10:53:35 AM6/2/12
to microco...@googlegroups.com
Are you sure? Can you check the version of both Node and Express you are using?

Muhammad Al-Syrwan

unread,
Jun 2, 2012, 11:03:18 AM6/2/12
to microco...@googlegroups.com
i think npm is responsible for checking versions .. isn't it ?

Amjad

unread,
Jun 2, 2012, 11:04:20 AM6/2/12
to microco...@googlegroups.com
That's right for express, but not for node.

Muhammad Al-Syrwan

unread,
Jun 2, 2012, 11:06:49 AM6/2/12
to microco...@googlegroups.com
node v0.6.18

Amjad

unread,
Jun 2, 2012, 11:30:57 AM6/2/12
to microco...@googlegroups.com
I'm using v.6.14

Amjad

unread,
Jun 2, 2012, 11:35:02 AM6/2/12
to microco...@googlegroups.com
I don't think it is because of the version I'll check it out..

Amjad

unread,
Jun 2, 2012, 11:40:39 AM6/2/12
to microco...@googlegroups.com

Amjad

unread,
Jun 2, 2012, 12:30:16 PM6/2/12
to microco...@googlegroups.com
I got it.

You need to run your mongoDB server

$ mongod

Muhammad Al-Syrwan

unread,
Jun 2, 2012, 3:47:44 PM6/2/12
to microco...@googlegroups.com
Nice :)
Now my new error is :D
/home/mhdsyrwan/rails_projects/microcommunity/node_modules/mongoose/lib/utils.js:413
        throw err;
              ^
TypeError: Cannot read property 'name' of undefined
    at Promise.<anonymous> (/home/mhdsyrwan/rails_projects/microcommunity/app.js:64:23)
    at Promise.<anonymous> (/home/mhdsyrwan/rails_projects/microcommunity/node_modules/mongoose/lib/promise.js:120:8)
    at Promise.<anonymous> (events.js:67:17)
    at Promise.emit (/home/mhdsyrwan/rails_projects/microcommunity/node_modules/mongoose/lib/promise.js:59:38)
    at Promise.complete (/home/mhdsyrwan/rails_projects/microcommunity/node_modules/mongoose/lib/promise.js:70:20)
    at cb (/home/mhdsyrwan/rails_projects/microcommunity/node_modules/mongoose/lib/query.js:918:32)
    at /home/mhdsyrwan/rails_projects/microcommunity/node_modules/mongoose/lib/utils.js:408:16
    at /home/mhdsyrwan/rails_projects/microcommunity/node_modules/mongoose/node_modules/mongodb/lib/mongodb/cursor.js:133:9
    at /home/mhdsyrwan/rails_projects/microcommunity/node_modules/mongoose/node_modules/mongodb/lib/mongodb/cursor.js:173:11
    at /home/mhdsyrwan/rails_projects/microcommunity/node_modules/mongoose/node_modules/mongodb/lib/mongodb/cursor.js:467:35


I think the problem is that the database is empty ... 

Is there any think like rake db:migrate ?

Amjad

unread,
Jun 2, 2012, 4:01:42 PM6/2/12
to microco...@googlegroups.com
Yes you are right.

This is NoSQL, the problem is that there is no data, not that there is no schema :)

BTW, You don't event have to create a database, it will create one for you on the fly :)

Try to create a post manually by this line:

post.save(function (err) {
  if (!err) console.log('Success!');
});

on line 27 of app.js

Test that this worked by visiting /api/posts

Muhammad Al-Syrwan

unread,
Jun 2, 2012, 5:58:27 PM6/2/12
to microco...@googlegroups.com
it worked :)

Muhammad Al-Syrwan

unread,
Jun 2, 2012, 5:59:02 PM6/2/12
to microco...@googlegroups.com
it looks great :)

Muhammad Al-Syrwan

unread,
Jun 2, 2012, 6:01:11 PM6/2/12
to microco...@googlegroups.com
we have the same old problem, all the people have your pictures 

i am a guest, i can post as a guest, but your profile picture appears instead of nothing 

Amjad

unread,
Jun 3, 2012, 3:13:50 AM6/3/12
to microco...@googlegroups.com
I know, don't worry, we haven't finished the server-side yet.

I also have a great new layout that will the make MicroCommunity groups really really cool.

Inshalla I'll try to release them as soon as I can....

Muhammad Al-Syrwan

unread,
Jun 3, 2012, 9:39:06 AM6/3/12
to microco...@googlegroups.com
i have 2 questions
  • what is the meaning of variable "_" 
  • what is the meaning of the @ sign in your coffescript code

Muhammad Al-Syrwan

unread,
Jun 3, 2012, 9:42:42 AM6/3/12
to microco...@googlegroups.com
i know that @property is equivalent to this.property, but when the "@" sign is alone , is it meant to be this ?!

as an example you can see this
_.bindAll @

Amjad

unread,
Jun 3, 2012, 3:43:38 PM6/3/12
to microco...@googlegroups.com
"_" is underscore.js utility library used by backbone

As for your other question you might be interested in having a look at this small tutorial. It will help you get familiar with backbone and coffee
http://adamjspooner.github.com/coffeescript-meet-backbonejs/

Muhammad Al-Syrwan

unread,
Jun 3, 2012, 5:34:36 PM6/3/12
to microco...@googlegroups.com
Nice Tutorial :)

Walid A.H

unread,
Jun 19, 2012, 5:09:18 AM6/19/12
to microco...@googlegroups.com
Mhd Syrwan said that there are difficulties.. So what the difficulties of learning Node.js ? and what the features that make you switch to it instead of rails ?!!


Muhammad Al-Syrwan

unread,
Jun 19, 2012, 5:48:11 AM6/19/12
to microco...@googlegroups.com
Hi Walid :)
for you, there is no difficulties :D

i'm afraid that changing technologies repeatedly makes some people feel disappointed .

Walid A.H

unread,
Jul 2, 2012, 6:59:46 AM7/2/12
to microco...@googlegroups.com
:D
Reply all
Reply to author
Forward
0 new messages