What do front-end developers need to know about the backend?

The vast majority of things that front-end developers should do can be done without knowing anything about the backend except the API.


However, if you have been working with various tasks for a long time, most likely you will come across something that requires some knowledge in the field of backend.


Below is a short list of what an interface designer should be aware of.


Request frequency


The backend has limited resources, it can process requests only with a certain frequency. In general, you should not think about it - the frontend should do everything that is necessary to provide a quality user experience, while the backend, in turn, can be optimized and scaled. Nevertheless, network requests to the backend are not free and have different prices (in the terminology of the resources used)


How can we measure how costly the request is?


One of the practical rules tells us that recording is always more expensive than reading, so the more data is written, the more expensive the queries become.


Let's look at an example of when this becomes critical: suppose we are developing google docs.


, . ?


, . , 99% 1%.


, , .doc . ? , , .


, : , . , , .


(downtime)


- . , - .


, " ", ( , , )


, . , e , .


, try catch . javascript (recovery panic), , .


HTTP


HTTP ( ). , 400.


, .


, , , 401 .


, 400- , , . 500- , .


HTTP :


  • HTTP . ( 20 ), -, . , -.
  • ( ), HTTP (multipart/form-data), .
  • , URL. - query , 2048 , HTTP .


- , ?


. :


  1. — . , , .
  2. , . macbook, chromebook 100 .
  3. . pro . , - - .

-


, , - - . (Same-Origin Policy). , .


npm/yarn , -.


:


  • hosts nginx*.
  • c- , production false, development true.
  • .

(CSRF) — , .


: - javascript , .()


, CSRF , - . .



. , , , .
- , , favouritewebsite.com/static/script.js.


script.js? . , script.js script.js?v=2, index.html.
script.js , ( index.html ! index.html ).


, javascript script.4e885f13.js. css , .


, .


* Translator's note:


In the original it was like this:


Map your server domains to some hostname in your dev environment's host config.

I could misunderstand what the author wanted to say, so I add a footnote.


All Articles