ndelvalle/generator-api

Switching to restify instead of expressjs

marko-ciric opened this issue ยท 3 comments

This is a proposition of switching from https://github.com/expressjs/express to https://github.com/restify/node-restify. Some of the reasons are:

  • Since the idea of a generator is to be used presumably for REST API projects, meaning no server-side page rendering, the app could be far lighter by using restify framework.
  • restify is more robust when it comes to error handling (http://restify.com/#error-handling), since it comes with built-in Error objects that are easily mapped to proper http errors.
  • A lot of parsers are also built-in (http://restify.com/#bundled-plugins).

I tough about it, and I decided not to make the change. The main Idea is like you said using this generator for a REST API project, and using restify would be a really good approach. But at this point, having the project nearly finish, I don't think it would be worth. Is not an small change and I'm really satisfied with express performance / community etc.

The 2 possible solutions for using restify instead of express in my opinion would be:

  • Make it optional when generating the project, to allow the user to choose the framework. (In mi humble opinion, most users would choose express)
  • Creating a new generator, same as this one, but using restify

Maybe there is another good option that I'm not seeing, but I wont be implementing on of these right away. I would really like to, at some point tho.

If you have in mind some other options, or would like to help me implement on of the above, let me know ๐Ÿ™‚

@ndelvalle I think the first solution is a reasonable one (having an option to choose between different frameworks) as that's what I've seen in other generators. I can work on that option if that's ok with you.

@marko-ciric of course that would be great ๐Ÿ‘. Let me know if you need help implementing it. And thanks in advance!