Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const router = new UniversalRouter(routes, {
baseUrl: process.env.APP_BASE_URL,
resolveRoute(context, params) {
if (typeof context.route.load === 'function') {
return context.route
.load()
.then(action => action.default(context, params));
}
if (typeof context.route.action === 'function') {
return context.route.action(context, params);
}
return undefined;
},
});
export const toUrl = generateUrls(router, {
stringifyQueryParams: queryString.stringify,
});
export default router;