A web site rendered using vue2 server, its general flow:
Node Server Accepts Client’s Request
Then request data from other servers
Render the acquired data to vue
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: