How does the server deploy front-end separation?

recently I want to write a trial hand of a project with front and rear separation.
since I have been self-taught nodejs, all this time, the idea is to build a back-end server with express framework, but in this way I don"t know what to do in the middle tier. Now the only thing I can think of is to use express, in the middle tier, but I think it"s a little silly.
so I read a lot of articles on the Internet, many of which talk about using PHP in the back end or express in the middle layer of Java,.
so I want to ask:
1. If you use express as the backend, is there a big gap between performance and PHP?
2. If express is used as a server, what is better for the middle tier?
3. And npm"s mysql feels so troublesome to operate, and you have to write all kinds of native sql statements. Is there an encapsulated semantic database query plug-in like thinkphp or lavarel?


small projects do not need a middle tier.
the backend express or koa can directly provide data. The api front end calls api to get the data


in response to your problem, let me talk about our current practice:
1, we think that href= is too heavy and useless. We directly use koa2 to build the backend, because Node.js is asynchronous and non-blocking. Therefore, the performance is still better; However, there are a lot of articles about the comparison between Node.js and PHP, which can be found to see that different test samples are different from the environment.
2, the API provided by the backend is Restful, there is no intermediate layer, and the front end is called directly.
3, you can learn . A large number of SQL operations are packaged, which are similar to Ruby's ides.rubyonrails.org/active_record_basics.html" rel= "nofollow noreferrer" > ActiveRecord .
hopes to help you.


doesn't the complete separation of the front and rear ends mean that the backend can just provide api, front-end calls? why do you need an intermediate layer? I think the front and rear ends are separated and rendered directly on the client rather than on the server.

nodejs's high concurrency performance is very good. Middleware is also available for databases. For example, sails.js 's waterline, does not require you to write sql statements yourself


the front and rear ends are separated. If the project is small, you can directly call the back-end API, as long as you can provide API,. It doesn't matter what language you use.

Menu