November 2017
Beginner to intermediate
398 pages
8h 42m
English
Create a new src/entry-server.js file that will be the entry point for the server bundle. It will export a function that gets a context object from the HTTP server we will build later. It should return a Promise that resolves with the Vue app when it's ready.
We will pass an url attribute to the context so that we can set the current route like this:
router.push(context.url)
Similarly to the client entry, we also use the createApp function to create the root app instance, the router, and the store. entry-server.js should look like this:
import { createApp } from './app'export default context => { return new Promise(async (resolve, reject) => { const { app, router, store } = await createApp(context) // Set the current route Read now
Unlock full access