Wednesday, 8 May 2019

How does pre-rendering works?

The following is my current understanding of prerendering. Please correct me if I am wrong.

Imagine I have an Angular 7 application dashboard gated behind a login page. I will use angular universal (or other tools) to prerender login page and dashboard page (just a shell with loader), which will live with rest of my app as login/index.html and dashboard/index.html.

If users go to /login or /dashboard page, Nginx will check if cookie. If cookie says the user is logged in, Nginx will serve dashboard/index.html, otherwise, Nginx will serve login/index.html

Is the above correct?

Also, I have two questions:

  1. What if someone is not using Nginx and just using S3? How will they handle the above scenario without cookie access?

  2. What if someone goes to the unknown router? Say /not-found-route? How do you show a 404 page using prerendering?



from How does pre-rendering works?

No comments:

Post a Comment