官术网_书友最值得收藏!

The basic setup

The basic setup to make an application work is the logical request flow, which looks as follows:

Here's how the logical request flow works:

  1. The client requests our site.
  2. The Express.js server handles these requests and serves a static HTML file.
  3. The client downloads all necessary files, according to this HTML file. The files also include a bundled JavaScript file.
  1. This bundled JavaScript file is our React application. After executing all JavaScript code from this file, all required Ajax alias GraphQL requests are made to our Apollo Server.
  2. Express.js receives the requests and passes them to our Apollo endpoint.
  3. Apollo queries all requested data from all available systems, such as our SQL server or third-party services, merges the data, and sends it back as JSON.
  4. React can render the JSON data to HTML.

This workflow is the basic setup to make an application work. In some cases, it makes sense to offer server-side rendering for our client. The server would need to render and send all XMLHttpRequests itself before returning the HTML to the client. The user will save one or more round trips if the server sends the requests on the initial loadWe will focus on this topic in a later chapter, but that's the application architecture in a nutshell. With that in mind, let's get hands-on and set up our development environment.

主站蜘蛛池模板: 梧州市| 资源县| 新民市| 阿拉尔市| 新绛县| 鹿泉市| 平南县| 万宁市| 噶尔县| 梅河口市| 谢通门县| 万年县| 凤庆县| 新建县| 桂东县| 登封市| 河池市| 遵义市| 云安县| 昭觉县| 迭部县| 大化| 池州市| 抚州市| 土默特右旗| 张家川| 凤台县| 芷江| 乐安县| 永靖县| 马边| 华容县| 鹿泉市| 桓台县| 年辖:市辖区| 太湖县| 乐昌市| 呈贡县| 同仁县| 彭阳县| 新邵县|