S
S
Sergey2017-06-19 10:15:07
JavaScript
Sergey, 2017-06-19 10:15:07

What to use on the backend for SPA applications?

My project is powered by Yii2 and MySql on the backend and JS with jQuery on the front. Now I understand the need for SPA architecture, Angular or React has not yet decided. One thing is clear, that the thick client exchanges JSON data using the REST API. It's not clear to me what to use on the server to process the application's API requests. Mobile applications are planned in the future, so I want to have one work logic on the server.
Now, if I use Yii2 or another php framework, then what's the point in it if most of its functionality is not needed, controllers, actions, routing, helpers, etc., in fact, I only need models from it and that's it.
There is an option to use Node.js, but it still needs time to learn, rewrite the logic with its asynchrony. The question also arises of the rationality of using the mySql base or switching to mongoDB, how to organize the architecture, are there frameworks or is it enough to use express.
What is better to use on the backend at the moment and what is used more often in practice?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
M
Maxim Fedorov, 2017-06-19
@qonand

Yii2 or another php framework, then what is the point of it if most of its functionality is not needed, controllers, actions, routing,

How is it? For the REST API, just controllers, routings, etc. oh how needed
But it’s just better to make models independent of the framework, because. models are business logic, and when it depends on the framework it is Bad Practice
The question also arises of the rationality of using the mySql database or switching to mongoDB
Database rationality has nothing to do with API interaction. It doesn't matter if you use the REST API or not. It all depends on what tasks your project solves, what data is stored in it, what requirements you have for the database, etc. In general, the answer to this question depends on many factors and is individual for each task. There are a number of tasks for which the use of a relational DBMS is optimal, there are tasks for which it is better to use a documented database.
Everything again depends on your requirements and tasks. Need to make a fast application in a short time - use Yii, need to make an application with a well-organized architecture - use Symfony

O
Oleg Gamega, 2017-06-19
@gadfi

if you don’t need server rendering, then there is no particular advantage in node.js;
if everything works for you on mysql, then there’s no point in switching to mongodb either, you need to use nosq wisely and when you need it, if you don’t need it, you don’t need to use it
and what's the problem then?
if you know Yii2 well, use it, if you don't know Yii2, but you know php, take microframework slim or similar

M
Maxim Timofeev, 2017-06-19
@webinar

It's not clear to me what to use on the server to process the application's API requests

www.yiiframework.com/wiki/748/building-a-rest-api-...
Perhaps this is necessary, but it is not obvious from the description.
Creating a REST api in almost two lines of code
Yes there is such an option
Depends on the data architecture. In a particular project, it will be justified to use one or another base. There is mongi support in yii, but the community rarely works with it, so there will be no one to ask for advice. You will have to figure it out yourself.
It is better to use what you know and what suits the project. But they use wp more often, but this hardly means that it is worth using it.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question