10

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});
});
Linny
  • 818
  • 1
  • 9
  • 22
Juhil Kamothi
  • 213
  • 1
  • 10
  • 3
    Does this answer your question? [503 ok (from serviceWorker)](https://stackoverflow.com/questions/44370912/503-ok-from-serviceworker) – farokh veician Dec 30 '20 at 06:09
  • you dont need to do that , your problem is related with [Content Security Policy (CSP)] PWA offline feature is not enabled in your browser check [this](https://stackoverflow.com/questions/44370912/503-ok-from-serviceworker/65465345#65465345) question wich is related with your problem. – farokh veician Dec 30 '20 at 06:13

0 Answers0