What is a good back-end to use with AngularJS

STheFox picture STheFox · Oct 19, 2014 · Viewed 86k times · Source

I want to know your suggestions about a good back-end to use with AngularJS as a front-end.

Why is your suggested back-end good and is it easy to use, or easy to learn?

Answer

David picture David · Oct 19, 2014

There is considerable risk in this question for opinion-based answers, so I suggest a more critical evaluation:

Restful server-side implemenations

... Will make working with angular considerably easier and less painful as well as being true to the HTTP spec with all the good things that entails. In any language that you choose ensure that the framework allows for the minimum of effort in doing this.

In my experience:

PHP:

Vanilla PHP and Codeigniter are capable but poor at doing this, I suggest avoiding them. I cannot speak for Symfony and the larger ORM-based frameworks, but I understand the learning-curve to be non-trivial. I strongly suggest staying away from CMS applications like wordpress and drupal as this kind of thing is not their purpose.

I understand that Laravel may offer a reasonably low learning curve and is has the understanding of RESTFul interfaces baked in.

NodeJS

NodeJS offers a very large number of frameworks for the server-side with Express and its variants being the apparent base for many of them. Express offers the flexibility to create RESTful interfaces, but does not do this by default. For more syntactic sugar it is usually necessary to wire up your own middleware.

Ruby on Rails From what I understand there is considerable support for RESTful apis with rails.

Database support

PHP Vanilla PHP mysqli Support for databases works, but is too low-level for use. CodeIgnighter, Symfony, Lavel and other frameworks all offer the necessary abstraction and security for working with the database to varying degrees. Differentiating between them on this is largely a matter of taste. PHP frameworks may struggle for support for NoSQL type newer databases.

NodeJS Express Supports all major forms of databases with appropriate middleware with literally thousands of options from the NPM repositories. As usual, you will have to wire them up to express yourself with varying degrees of difficulty.

Ruby on Rails Rails supports the active-record pattern which offers both security and ease of use out of the box. This supports the majority of popular standard relational databases. I cannot speak for its integration for NoSQL databases however.

Learning curve

This is too subjective for me to say much other than a few pitfalls: the NodeJS community expects a fairly high degree of skill to get started and the callback hell problem is sufficiently large to be a serious barrier to learner server-side development.

Security

PHP Vanilla PHP offers little security and is not recommended. Codeigniter, Laravel and the other frameworks offer some protection with string-escaping and protection against SQL injection attacks at least.

NodeJS Express doesn't offer too many security features out-of the box but can be hardened with modules like helmet. This is not a deficiency so much as a reflection of the unopinionated nature of the application.

Rails I understand Rails offers basic SQL injection protection through Active Record and CSRF protection among other features out of the box.

Personally: I use Koa (an application to supersede express) for my own server-side dev in working with angular. My legacy projects use CodeIgnighter.