This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Вместо div app в welcome.blade.php | |
$output = shell_exec('/Users/maximkolmogorov/.nvm/versions/node/v16.15.0/bin/node ../bootstrap/ssr/server-app.mjs ' . $url); | |
echo $output; | |
?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Illuminate\Support\Facades\Route; | |
use Illuminate\Http\Request; | |
Route::get('/', function (Request $request) { | |
return view('welcome', [ | |
'url' => $request->path() | |
]); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { createWebHistory, createMemoryHistory, createRouter } from 'vue-router'; | |
const isServer = typeof window === 'undefined'; | |
const history = isServer ? createMemoryHistory() : createWebHistory(); | |
import Home from './pages/Home.vue'; | |
import About from './pages/About.vue'; | |
const routes = [ | |
{ path: '/', name: 'home', component: Home }, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* global var process from node */ | |
import { createSSRApp } from 'vue' | |
import { renderToString } from 'vue/server-renderer' | |
import router from './router.js'; | |
import App from './App.vue'; | |
(async function main() { | |
const requestUrl = process.argv[2] || '/'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import './bootstrap'; | |
import { createApp } from 'vue'; | |
import router from './router.js'; | |
import App from './App.vue'; | |
const app = createApp(App); | |
app.use(router); | |
app.mount('#app'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<!-- Типо template --> | |
<div id="app"> | |
<!-- Навигация --> | |
<nav class="flex flex-wrap"> | |
<router-link | |
:to="'/'" | |
> | |
Главная | |
</router-link> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<div> | |
<h1>About</h1> | |
<section class="text-xl mb-12"> | |
<p class="mb-8"> | |
This is a quick demo app for server side rendering Vue with Laravel. Below is a list of our open source packages, which our client-side app has | |
divided by type. | |
</p> | |
</section> | |
</div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<div> | |
<h1>SSR with Laravel & Vue </h1> | |
<section class="text-xl mb-12"> | |
<p class="mb-8"> | |
This is a quick demo app for server side rendering Vue with Laravel. Below is a list of our open source packages, which our client-side app has | |
divided by type. | |
</p> | |
<p> | |
We're using vue-router for this page so each package type has its own permalink, and will be prerendered |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { createWebHistory, createRouter } from 'vue-router'; | |
import Home from './pages/Home.vue'; | |
import About from './pages/About.vue'; | |
const routes = [ | |
{ path: '/', name: 'home', component: Home }, | |
{ path: '/about', name: 'about', component: About }, | |
]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="ru"> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<title>Hello Blade</title> | |
@vite('resources/sass/app.scss') | |
</head> | |
<body> |