Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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);
}