A
A
Apstrew2020-05-22 11:16:02
Frontend
Apstrew, 2020-05-22 11:16:02

If the frontend part (React) lives on the server, is it still a frontend?

Hello everyone

The question, by the way, is not about the wording at all, but about the structure of modern web applications.

I always thought that the frontend was for that and the frontend, to spin on the client side. And that babel and webpack and others are needed to pack the development and give it to the client, for whom this stuff will work on (almost) all browsers and communicate with the backend on the server through endpoints.

But I came across an example: I run the backend with the npm run command, the front end - roughly speaking - in the next window with the same command. Communicate with each other with GraphQL queries. And this gives rise to a number of sub-questions:

1. Why do you need babel, why do you need transpilation and the map code, if this goodness still works on your server, in a known environment? Why transpile the typescript into javascript at all, if the browser receives ready-made commands of what and where to draw and does not read your javascript?

2. How does (did?) deploy an application in which React work in the classic way on the client in the browser? Prod-piece was assembled, and then uploaded to the server in the public_html folder via some good old FTP?

3. Why, if everything is considered on the server, and we receive only requests from the client - keep the division into frontend and back? Doesn't this profane all the benefits of separating the front and the back?

4. Can we say that SSR is needed to: Not give the client a single gram of business logic? + Speed ​​up work even on a weak client machine?

5. If the SSR approach prevails - does this mean that web pages will soon be given in the form of video or something in conjunction with webassemblies? How "correct" is this, given that the total capacity of client machines is growing faster (because people buy powerful smartphones)?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
R
Robur, 2020-05-22
@Robur

Are you writing to us from 2040? It seems that in your world no one has been running JS code in a browser for 15 years already.
SSR is used in 1% of cases, and then - almost always the same code then gets into browsers and will work there, so it needs babel, webpack and everything else .
1. The browser receives the JS and executes it. Therefore, all of the above is required.
2. in 2040 it probably doesn’t matter anymore, but in our 2020 there are still a lot of methods to deploy and deploy browser-based applications.
3. I don’t know where it is for you everything is considered on the server, in our 2020 99% of the web application code is still running in the browser. 1% is build-transpilation-dev-servers.
4. we can’t, SSR is not for this, it is to give the client the initially rendered HTML and then load the application there. There are projects that render web applications to static HTML, which are then given to the browser, but in our 2020 this is still exotic.
5. If sufficient. But he is not. Although the idea of ​​super thin video clients has been in the air since the days when people who remember warm tube mainframes bought the first PCs and began to indulge in nostalgia. There are also such projects, but in our 2020 they are even more exotic than SSR without an active client. Although I personally participated in this.
Whether they will be expressed in something massive or not - time will tell. My opinion - no, it's much easier and cheaper and more efficient in many respects to draw a million web pages on millions of clients than on one large server and give it to everyone in the form of a video.

U
uvelichitel, 2020-05-24
@uvelichitel

Backend, which I specialize in, in my understanding, server programming. The server serves many clients, sometimes very many 24/7, and must provide a predictable quality of this service. The client is obliged to provide a friendly human-machine interface. Of course, the client-server is not the only one (for example, there is also bitcoin, bittorrent, webrtc, tox and all sorts of p2p), but a popular network model. I know how to use GraphQL for a hobby, but I didn’t get paid orders, maybe I was unlucky ...

P
PxlFxr, 2020-05-24
@PxlFxr

Comrade, first you need to know how the browser and the server work, so as not to ask such tough questions. Leave alone react and ssr. To learn how to run, you first need to at least learn how to walk.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question