How to use the @vuepress/core/lib/app/serverEntry function in @vuepress/core

To help you get started, we’ve selected a few @vuepress/core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github appcelerator / titanium-docs / docs / .vuepress / app / serverEntry.js View on Github external
export default context => new Promise((resolve, reject) => {
  originalServerEntry(context).then(app => {
    const router = app.$options.router;
    const store = app.$options.store;

    sync(store, router);

    router.onReady(() => {
      const matchedComponents = router.getMatchedComponents();
      if (!matchedComponents.length) {
        return reject({ code: 404 })
      }

      const apiRoutePattern = /^\/api\//;
      const currentRoutePath = router.currentRoute.path;
      if (!apiRoutePattern.test(currentRoutePath)) {
        return resolve(app);
      }