View Vagrantfile
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
# Edit these | |
hostname = "vagrant.dev" | |
server_ip = "192.168.33.10" | |
mysql_root_password = "root" | |
Vagrant.configure(2) do |config| | |
# OS to install on VM |
View Home.vue
<script> | |
export default { | |
async asyncData ({ store, route }) { | |
// ... | |
// Prefetch CMS data on the server | |
await store.dispatch('cmsBlock/list', { | |
filterValues: ['home_banner'] // Array of CMS blocks identifiers on the page | |
}) | |
} | |
} |
View NewPromotedOffers.vue
<template> | |
<section v-if="!singleBanner" class="offers container my30 px15 cl-black"> | |
<div class="row"> | |
<left-banner :identifier="'home_banner'" /> | |
<!-- ... --> | |
</div> | |
</section> | |
</template> |
View parser.js
import { parse } from 'node-html-parser'; | |
const root = parse('<ul id="list"><li>Hello World</li></ul>'); | |
console.log(root.firstChild.structure); | |
// ul#list | |
// li | |
// #text | |
console.log(root.querySelector('#list')); |
View PromotedOffers.vue
<template> | |
<section v-if="!singleBanner" class="offers container my30 px15 cl-black"> | |
<div class="row"> | |
<cms-block :identifier="'home_banner'" /> | |
<!-- ... --> | |
</div> | |
</section> | |
</template> |
View server-express.js
const express = require('express'); | |
const { middleware } = require('@magento/upward-js'); | |
async function serve() { | |
const app = express(); | |
const port = 8000; | |
app.get('/', (req, res) => res.send('Hello from Express!')); | |
const upwardMiddleware = await middleware(`${__dirname}/upward.yml`); |
View getPokemonDetail.graphql
query($pokemonName: String) { | |
pokemon(name: $pokemonName) { | |
name | |
image | |
types | |
weight { | |
minimum | |
maximum | |
} | |
height { |
View upward-ssr-styled.yml
status: response.status # [Go to 1] | |
headers: response.headers # [Go to 1] | |
body: response.body # [Go to 1] | |
# 1 | |
response: | |
when: | |
- matches: request.url.pathname | |
pattern: '^/pokemon/graphql' | |
use: pokemonGQL # [Go to 2] |
View pokemon-ssr.mst
<img src="{{pokemonData.image}}" /><br/> | |
<strong>Name:</strong> {{pokemonData.name}}<br/> | |
<strong>Type:</strong> | |
{{#pokemonData.types}} | |
{{.}} | |
{{/pokemonData.types}} | |
<br/> | |
<strong>Height:</strong> | |
{{pokemonData.height.minimum}} - {{pokemonData.height.maximum}}<br/> | |
<strong>Weight:</strong> |
NewerOlder