Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (data[id]) {
return Module.restore(data[id], dependencies);
}
}
};
diConfig.factories = [
createRestoreFactory(diData),
createMethodFactory(),
createInstanceFactory()
];
diConfig.resolvers.push(staticResolver({FetchRequest}));
diConfig.dependencies.request = 'FetchRequest';
let di = createContainer(diConfig);
di.put('renderer', new DomRenderer());
then(di({'env': 'env', router: 'router'}, {di}), ({env, router}) => {
return router.start().then(event => {
env.render(event.page, document.body.firstChild);
});
});
export function serverRender(req, res, next) {
let di = createContainer(diConfig);
di.put('renderer', new StringRenderer());
Promise.resolve(di({router: 'router', 'env': 'env'}, {di}))
.then(({router, env}) => {
return router.match(req.url).then(({page}) => {
return env.render(page)
});
})
.then(body => {
let definitions = di.getDefinitions(),
promises = [];
Object.keys(definitions).forEach(key => {
let {instance} = definitions[key];
if (instance && instance.async) {