Good server side solution for angular.js

I am using Angular.js for my project. The business logic is developed in Angular. I'm just looking for two things:

  • I need a way to easily authenticate users, and I donโ€™t know how to implement it through Angular.

  • I need a server-side framework that provides REST Api, api for implementing a relational data model and a good caliper for databases like Postgres or Mysql.

Now I use the Django environment for these two things, it works fine with databases and provides a great api for working with data, but I feel that using Django with Angular is not a good solution, because I do not use most of the functions provided Django I just need a simple REST api with a good api data model. Any suggestions for me?

+4
source share
3 answers

I think it really depends on what exactly you are using from Django. If the API is simple, you do not use many classes of middleware, context processors, etc., then you can remove it. If you use Python there are tons of WSGI lightweight web frameworks like Bottle or Flask . They usually perform a little better than Django +, they are mostly written, so you can easily create a REST API. The โ€œdrawbackโ€ is that if you need certain things, such as SQL ORM or some cache processing, you must include these batteries separately and you cannot use your own parts of Django, which you are probably used to. It also includes a roll of your own authentication system.

I think you need to find out if you really want to rewrite the code. I personally think that a small increase in productivity is often not worth the effort and time.

+4
source

Regarding question 1 (authentication), this blog post + sample explains a great solution: https://github.com/witoldsz/angular-http-auth

I don't know anything about Django, but I would be surprised if you couldnโ€™t change its rendering mode. I used Express (Node.js) to open the REST api. It was easy to switch from rendering HTML to JSON.

+1
source

This may not be appropriate for your environment (not sure which platform you are on), but our current project uses AngularJS with REST-like content created using the ASP.NET Web API. Everything goes well. Because the Web API is built on top of ASP.NET, you get authentication โ€œfor free,โ€ and there is no shortage of relational underlying database structures for .NET. We are using the Entity Framework Code-First with some Massive thrown here and there. This works just fine for what we need, and integrates very quickly and easily, but you can also use NHibernate or any of the many other frameworks available for .NET.

+1
source

Source: https://habr.com/ru/post/1442262/


All Articles