Server-side javascript framework

511 views
Skip to first unread message

Freewind

unread,
Apr 28, 2012, 10:59:38 PM4/28/12
to ang...@googlegroups.com
I was used to use java as the server-side language to provide restful api for angularjs. But now I try to use javascript on the server side, that I can use the same language in both side, and don't need to convert json to other objects everywhere.

But I'm newbie to server-side js, I don't know is there any best practices. Please give me some advices, thank you.

I want to build a website, which has many groups, and people can write articles in any group. It will be running on a 512RAM vps box(which is on burst.net) at the beginning(maybe a long time).

1. I'm using node.js. I found it has built-in support for creating web server, is it production ready?
2. I found there is a web framework "express", is it better than the nodejs'?
3. Do I need to learn coffeescript if I want to be more productive?
4. Which database should I use? Mongodb or couchdb?
5. Is there any other good js libraries which used widely that I should learn?
6. Other advices to make me a better js developer?

I've used Java for nearly 7 years, and now I feel a little disappointed that it's not as productive as I expected to build websites, so I trying to jump to javascript world. 

Angularjs is the main reason I decide this. Amazing framework, warmhearted people in this group, quick responses and helps, thank you all!

Dan Doyon

unread,
Apr 29, 2012, 12:21:22 AM4/29/12
to ang...@googlegroups.com
Here's a thread that should probably be of interest to you

https://github.com/dalcib/​​angular-phonecat-mongodb-rest 

in regards to your queries,  for #6, I can tell you first hand, learning todo angular correctly and writing tests will make you a better js developer IMHO. 
I'll let others chime in on the other ones.

cheers

--dan

--
You received this message because you are subscribed to the Google Groups "AngularJS" group.
To view this discussion on the web visit https://groups.google.com/d/msg/angular/-/EZQhrQVIZmIJ.
To post to this group, send email to ang...@googlegroups.com.
To unsubscribe from this group, send email to angular+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/angular?hl=en.

Johan

unread,
Apr 29, 2012, 1:03:57 AM4/29/12
to ang...@googlegroups.com
Some points to consider:

- There are a number of content management / blog solutions built with Node and Mongo/Couch so I'd recommend exploring those first before building yet another one. 

- While its nice to be able to code client and server in the same language Node is designed for networked programs at quite a low level (for example have you tried to read/write a static file with Node from/to http?). 

- You mentioned productivity in java - you might be best to prove your idea first with java/python/php etc.  I do not expect node will be more productive since it is a low level "framework" - that is why solutions like Express have been written.

- There are a number of issues around keeping a node server running for example using node-forever to monitor processes and restart node it there is a problem. Most deployments you will still want to put a proxy server (nginx is popular) in front of Node for security and to handle static file serving. Unless you are experienced with these delopyment issues I'd go with a platform like nodejitsu (now on Joyent) where they take care of that for you. 

- You can used hosted mongo or couchdb solutions as well. Some are running on joyent anyway so you can have very fast performance even over REST/http connection to database. Mongo and Couch (like most things) have their own pros/cons - so you need to investigate based on your needs to make an informed choice. 

- CoffeeScript sure if you want to write class-based code and warm up for future ECMAScript. I prefer plain-o-JavaScript and not having extra transcoding that could bite me with testing/debugging.

Johan

unread,
Apr 29, 2012, 1:23:42 AM4/29/12
to ang...@googlegroups.com
You may want to check out the NodeJS in Action MEAP:  http://www.manning.com/cantelon/ 

TJ Holowaychuck is a prolific NodeJS contributor and creator of Express.

The MEAP has a good introduction to the event loop and also touches on deployment aspects like hosting your node apps.

Node web development from Packt is also a useful read:  http://www.packtpub.com/node-javascript-web-development/book 

I can recommend the "lets make a web app" series from DailyJS -  http://dailyjs.com/tags.html#lmawa 
Which covers building a blog with Node and Mongo (and backbone - you would of course use AngularJS)



On Sunday, April 29, 2012 2:59:38 PM UTC+12, Freewind wrote:

Freewind

unread,
Apr 29, 2012, 2:49:03 AM4/29/12
to ang...@googlegroups.com
Thank both of you. So many useful information, I will read them one by one.

About the choice of server-side language, I think the json support is very important. 

Many languages support json, but they are not as good as javascript.

See sjson in scala:

  JsObject(List(
            (tojson("lastName").asInstanceOf[JsString], tojson(p.lastName)), 
            (tojson("firstName").asInstanceOf[JsString], tojson(p.firstName)), 
            (tojson("age").asInstanceOf[JsString], tojson(p.age)) ))

or list-json with dsl:

  val json = 
    ("lotto" ->
      ("lotto-id" -> lotto.id) ~
      ("winning-numbers" -> lotto.winningNumbers) ~
      ("draw-date" -> lotto.drawDate.map(_.toString)) ~
      ("winners" ->
        lotto.winners.map { w =>
          (("winner-id" -> w.id) ~
           ("numbers" -> w.numbers))}))

There are so many noises in the code.


Johan

unread,
Apr 29, 2012, 4:52:23 AM4/29/12
to ang...@googlegroups.com
Well I doubt they would be as good as JavaScript since JSON is "JavaScript" Object Notation after all.

Main thing is that it is easy and accurate to convert to/from serialized JSON to objects in your server-side language of choice. 

Strongly vs weakly typed language on the server will no doubt have trade-off for serialize/deserialize.

Depending on what you are doing your application could exchange data directly with database - for example CouchDB and CouchApps allow you to code/run/serve (http) your entire app from CouchDB.

anh.tri...@googlemail.com

unread,
May 19, 2012, 1:08:34 PM5/19/12
to ang...@googlegroups.com
How about DWR?

ganaraj p r

unread,
May 19, 2012, 2:21:59 PM5/19/12
to ang...@googlegroups.com
If you are not interested in doing some serious server side stuff, I would suggest you to check out the new "server less " technologies like Spire.io or Firebase.

Also, you can use Meteor ( which is actually a node js  server side framework )

By the way, express is also a nodejs framework. 



How about DWR?
--
You received this message because you are subscribed to the Google Groups "AngularJS" group.
To view this discussion on the web visit https://groups.google.com/d/msg/angular/-/rZoEde_9WCwJ.

To post to this group, send email to ang...@googlegroups.com.
To unsubscribe from this group, send email to angular+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/angular?hl=en.



--
Regards,
Ganaraj P R
Reply all
Reply to author
Forward
0 new messages