I am using angular-universal in my PWA
app for SEO
purpose which is working fine, but it has the following issues
1). PWA
app is not working in offline mode.
2). During first time load of the app, it flickers screen component (i think it is due to SSR
)
So what I was thinking like if we are able to configure angular-universal like it will only process SSR on specific routes (i.e. product detail page) and rest of the routes will server as a normal angular app, so it will resolve screen flicker issue, also by default on root route it will work as normal angular app so PWA
on offline mode will also work.
Is there any way to configure SSR
on specific routes?
Here we can see that SSR
is applying for every route:
app.set('view engine', 'html');
app.set('views', join(DIST_FOLDER, 'browser'));
app.get('*.*', express.static(join(DIST_FOLDER, 'browser')));
app.get('*', (req, res) => {
res.render(join(DIST_FOLDER, 'browser', 'index.html'), { req });
});
app.listen(PORT, () => {
console.log(Node server listening on http://localhost:${PORT});
});