48

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?

ROMANIA_engineer
  • 54,432
  • 29
  • 203
  • 199
STheFox
  • 1,478
  • 4
  • 18
  • 24
  • This is a very broad question, *good* is something not very particular. In practice your backend never depends on your front-end. You backend should be independent (tomorrow you may use for your Mobile App ), RESTFul, follow good practices. – jdk2588 Oct 18 '14 at 22:56
  • OK, I was just asking this because there might be soms back-ends that interact with AngularJS better then others. So I guess not. Any suggestions of good back-ends, or back-ends that are easy to learn? – STheFox Oct 18 '14 at 22:58
  • Well, that depends how comfortable you are with the language and database that you want to use(SQL/NoSQL). A good backend is something that fits your problem statement and what you are trying to achieve. But yeah you can choose Python based (Django/Flask), JS based (NodeJS) – jdk2588 Oct 18 '14 at 23:02
  • Why should such a good question be flagged as off-topic and yet times have changed and new ways have cropped up which developers could add as answers to make this Question grow and become more relevant with the times? Sometimes I simply fail to understand the rationale behind these decisions. – Joseph Nov 22 '19 at 11:57

4 Answers4

42

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.

Stephan Vierkant
  • 9,674
  • 8
  • 61
  • 97
David
  • 964
  • 7
  • 14
  • 6
    There is also Java which is not a scripting language but it has Tomcat and GlassFish and has support for all DB kinds, it has a lot of libraries and user base. If you alredy used java you should try it – Pini Cheyni Feb 20 '16 at 05:23
  • Laravel is among other frameworks on of the best option for the backend. It is easy to use, it's very popular (look on google trends: https://www.google.it/trends/explore#q=laravel%2C%20ruby%20on%20rails%2C%20codeigniter ) and it offers many functionalities out of the box – dynamic May 05 '16 at 13:01
  • Agreed, Lavavel is better. I don't write PHP anymore, but answer this was written ages ago. Slant.com is better at this kind of question anyway. – David May 09 '16 at 04:23
  • what about firebase? – Ruben Jun 01 '17 at 11:25
  • 2
    This is a good answer, but I do think that it is missing Django, which is relatively popular – Ninjakannon Jun 15 '17 at 17:43
  • @Ninjakannon ff this Question was not flagged as off topic, some Python Developer would have weighed in and mentioned Python Django and Python Flask as other viable alternatives based on their experience. – Joseph Nov 22 '19 at 12:00
  • I came here to verify that Django is fine using with Angular, but no reference of it. Sad. – Nikhil Pareek Apr 07 '20 at 21:06
12

(disclaimer: I'm Ruby on Rails developer)

I believe Ruby on Rails is pretty good to use as json backend.

You can easily found a lot of materials and screencast about integrating it with angular, like:

And building proper JSON api with Rails can be helpful for creating mobile app etc, there also very good material about crafting good Rails RESTful Api, f.e.:

Olivier De Meulder
  • 2,493
  • 3
  • 25
  • 30
Esse
  • 3,278
  • 2
  • 21
  • 25
7

The back-end is up to you to choose, all back-ends should interact the same with Angular JS its more about what you are comfortable or more experienced with.

You have plenty of choices to look into:

Python: Flask and Django

Javascript: Node JS

Ruby: Ruby on Rails

PHP

Each will have their learning curves and pitfalls.

DevVex
  • 143
  • 1
  • 6
  • I heard of nodeJS already, haven't really worked with it though. I heard ExpressJS was a good back-end too. Ans it's based on NodeJS. Thanks for the tip – STheFox Oct 18 '14 at 23:01
7

I'm biased and I recommend Go because it is able to handle huge amounts of concurrent requests and fast (5000 and up) without consuming too many resources.

However jumping between 2 languages can be painful but in the end will give you a broader understanding of programming. So if you'd like not to switch languages remain with the express framework and node.js since that's where also all the tutorials are, MEAN stack for instance (mean.io)