S
S
Sergey delphinpro2020-09-12 17:34:26
Laravel
Sergey delphinpro, 2020-09-12 17:34:26

A hackneyed question: what about routing in Laravel + Vue + SSR?

The bundle is marked - Laravel + Vue + SSR.

The key issue is server rendering.
Condition - when the page is first loaded, DO NOT make requests for data for the page.
To do this, the Larkin controller works out and dumps the data state into the page body, which is then hydrated into an appliquha at the front.

Problem: duplication of routing on the client and server. If the routes are not duplicated on the server, then the state will be empty and vue will make a request to the api at initial load + more importantly , for search engines, the server render will return an empty page, without data. And this cannot be allowed.

What to do, fir-trees-sticks?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alex Wells, 2020-09-13
@delphinpro

It’s not at all clear what the server and Laravel have to do with it, and why the rounds need to be duplicated.
Laravel should not know anything about SSR at all - let the server on the node do it. And all that he, in turn, needs to do is fill VueX (or any other store) with the necessary data before rendering the page. Where to get them from is up to you. The control is limitless - upload what data when you want and how you want, the main thing is that the front should be more or less normally written.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question