News for hackers. Stuff that matters.
Re:Building REST APIs with Node.js by chrisennis on Sunday January 27, 2013 @06:43PM (#5126236)
As someone who has built APIs on node+express, I love it for small lightweight API's that require very little processing beyond getting data from a database and returning it.

I have gone through much frustration though when I needed to use it for an API that required processing that only made sense to handle synchronously. At that point, it becomes less practical.

Re:Building REST APIs with Node.js by general_failure on Sunday January 27, 2013 @07:28PM (#5126382)
For sync processing just use node modules - step or async. After all sync processing is a subset of async processing.
Re:Building REST APIs with Node.js by ishbits on Sunday January 27, 2013 @08:11PM (#5126519)
Why would one use Express to a purely services based app instead of just using straight up node?
Re:Building REST APIs with Node.js by nateweiss on Monday January 28, 2013 @12:35AM (#5127308)
Also consider using Connect (on which Express is built) as an in-between point. You get stuff like the Sinatra-style routing, but without the presentation-tier stuff like template support, etc. I've had good luck with it, FWIW.
Re:Building REST APIs with Node.js by byoung2 on Sunday January 27, 2013 @06:37PM (#5126205)
I'd also recommend Restify http://mcavage.github.com/node-restify/ for writing API's on Node.
Re:Building REST APIs with Node.js by helper on Sunday January 27, 2013 @07:38PM (#5126415)
I second this recommendation. Restify is targeted at APIs so it has built in support for things like API versioning, auto content negotiation and observability (via DTrace). This is not to say that express is bad or that you can't build APIs using express but rather that I find restify more enjoyable to use for APIs.
Re:Building REST APIs with Node.js by qdnguyen on Sunday January 27, 2013 @09:21PM (#5126736)
And lighter!
Re:Building REST APIs with Node.js by general_failure on Sunday January 27, 2013 @07:33PM (#5126399)
I recommend express simply because more people know about it. This really matters in an ecosystem so young as node. Information is very hard to get. Hint : compare the number of express and restify blog posts.

Note : I do use testify and its great.

In addition, if you want to take you rest a pi server to also provide web pages, express is more suitable.

Re:Building REST APIs with Node.js by jawerty on Sunday January 27, 2013 @07:07PM (#5126311)
I understand that restify has faster responses, but what else can put it on par with express?
Re:Building REST APIs with Node.js by dxchester on Sunday January 27, 2013 @08:01PM (#5126492)
If you're building REST APIs with Express and MySQL, check out this project I'm working on called Epilogue: https://github.com/dchester/epilogue

With Epilogue, once you define your models (with Sequelize), from there it's easy to get basic CRUD functionality and endpoints in a few lines of code.

Re:Building REST APIs with Node.js by shtylman on Sunday January 27, 2013 @07:41PM (#5126426)
You should not use '*' in dependencies ever! As history changes your app WILL break.

app.configure is also no longer needed. Just configure everything at the top level. If you have different config based on environment, use an if statement or some flag off the process.env

Re:Building REST APIs with Node.js by cmwelsh on Sunday January 27, 2013 @07:21PM (#5126358)
It would be a nicer example to use "pretty SEO URLs" for the individual post resources instead of a GET variable. I know even the Hacker News website goes against this, but it just looks more professional/polished to me, i.e.

    /posts/mytitle
Re:Building REST APIs with Node.js by jawerty on Sunday January 27, 2013 @07:36PM (#5126410)
I thought it would be better to have querying in the example to make it simpler to understand.
Re:Building REST APIs with Node.js by baugarten on Sunday January 27, 2013 @09:45PM (#5126822)
I am also working on a framework for quickly building REST APIs in node.

The project is currently at https://github.com/baugarten/node-restful and under development