Apr 25, 2021
2
Level 1
[Laravel api + vue 3 spa + ssr] Questions about the organization of the project
Hi, I have a question about laravel api + vue spa + ssr
How to organize a project correctly? I now have a vue spa frontend and laravel api (different directories)
Right now I want to add ssr using v8js (laravel-server-side-rendering).
The site does not allow you to insert the code (
//PostController
return view('posts', [
'posts'=> $post->get()
]);
//posts blade
{!! ssr('js/entry-server\.js')
->context('posts', $posts)
->render()[0] !!}
//Posts\.vue - post-list only, not the whole page
get data from context posts
// vue spa
<template>
<div class="post-list" v-html="html" />
</template>
Is this the correct approach? I need to do frontend logic on the backend if the page needs a pre-renderer?
Please or to participate in this conversation.