There is a one-page web application written in plain PHP using JQuery and AJAX . Users in it pass authorization. Everything is done by the most common methods: sending the form to the server, checking the login / password, storing data in the session. All scripts accessed by JQuery contain a check of the session data that the user is authorized, and the execution result may vary depending on the user ID .
I want to rewrite everything using AngularJS . The question is how to properly organize interaction with the $http service. Should REST ideology be followed and how important is it, does AngularJS philosophy fit? Maybe you should think about developing an API and then refer to it already. Where to store user data if not in session. In principle, everything will work of course, but I want to do exactly that. Advise in what direction to dig, what to read is not abstruse (in clear written language)
UPD: I re-read and understood that it is necessary to specify the questions, but it turns out garbage.
If I just store the user ID and password hash on the client (in $ scope variables) and use them when accessing the API, will this be the correct solution?
I have a number of PHP classes that implement the data model (CRUD and all that) and the dispatcher scripts to which I access via jQuery (pass data to POST), they check the authorization, call the necessary methods depending on the parameters and return result (usually HTML). I understand that it will be correct to save the entire data model and make another "dispatcher" who will parse the request (method, URL, parameters passed) and also call the necessary methods depending on the situation to form a JSON response. Right? Correct if I am mistaken.
Offtop Che, I often get the idea that you need to throw PCPs and write backends on something normal