How to use the mwp-router/lib/util.getRouteResolver function in mwp-router

To help you get started, we’ve selected a few mwp-router 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 meetup / meetup-web-platform / packages / mwp-core / src / renderers / server-render.jsx View on Github external
config: {
						apiUrl: API_ROUTE_PATH,
						baseUrl: host,
						enableServiceWorker,
						requestLanguage,
						supportedLangs,
						initialNow: new Date().getTime(),
						variants: getVariants(state),
						entryPath: url.pathname, // the path that the user entered the app on
						media: getMedia(userAgent, userAgentDevice),
					},
					flags,
				};

				const createStore = getServerCreateStore(
					getRouteResolver(routes, basename),
					middleware,
					request
				);
				return Promise.resolve(createStore(reducer, initialState));
			});
github meetup / meetup-web-platform / packages / mwp-core / src / renderers / browser-render.jsx View on Github external
export function resolveAppProps(
	routes: Array,
	reducer: Reducer,
	middleware: Array = []
): Promise {
	const basename = window.APP_RUNTIME.basename || '';
	const resolveRoutes = getRouteResolver(routes, basename);
	const createStore = getBrowserCreateStore(resolveRoutes, middleware);
	const store = createStore(reducer, getInitialState(window.APP_RUNTIME));
	return resolveRoutes(window.location).then(() => ({
		routes,
		store,
		basename,
	}));
}