When using vue2 server to render, how do you request data at the server and render vue

  node.js, question

A web site rendered using vue2 server, its general flow:

  1. Node Server Accepts Client’s Request

  2. Then request data from other servers

  3. Render the acquired data to vue

  4. Return the rendered object to the client

If there are any mistakes, please correct them.

So what I wonder now is,In steps 2 and 3, how to request data at the server and render vue, what tools are needed and how to implement them?

The interface that provides data is a common JSON format. The problem is how to make a request (pull or push data) to the interface (url address) like a browser in the node server.

I checked the official documents of vue2 and searched the relevant materials, but found no relevant description. Hope to know the great god to answer it.

In recent days, I have been studying vue’s server-side rendering. At present, I find that the following two packages can enable nodejs to request data from other servers. I am using axios now because I see that axios supports both nodejs and browsers. This is very useful for vue server rendering, I hope you can refer to it. The following is the address:

request

axios