99% of the time you won't have the user-routes file written manually. The routes in there should be automatically generated using some data from the database. How would you approach this?
Hello @ionellupu đ
Yes the route file was written manually for the purpose of this article.
I agree often you will have to generate this file from an external source like Database, CMS / API etc.
For example if we take product details pages for a E-commerce, we can get the product ids we need (ex: most viewed) from an api or script that generate the routes file locally or on a cdn. Then we can fetch this file before running our prerender script.
Its a suggestion, but of course it will depends on your over all architecture and needs.
Hi @maj07, I understand the approach you propose. However, I see Angular Universal pre-render as a way to run my CI pipe in order to generate all the html and then distribute the static pages on a CDN. So I think it's a bit overkill to have to run a server just to run a script for fetching the routes.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
99% of the time you won't have the
user-routes
file written manually. The routes in there should be automatically generated using some data from the database. How would you approach this?Hello @ionellupu đ
Yes the route file was written manually for the purpose of this article.
I agree often you will have to generate this file from an external source like Database, CMS / API etc.
For example if we take product details pages for a E-commerce, we can get the product ids we need (ex: most viewed) from an api or script that generate the routes file locally or on a cdn. Then we can fetch this file before running our prerender script.
Its a suggestion, but of course it will depends on your over all architecture and needs.
Hi @maj07, I understand the approach you propose. However, I see Angular Universal pre-render as a way to run my CI pipe in order to generate all the html and then distribute the static pages on a CDN. So I think it's a bit overkill to have to run a server just to run a script for fetching the routes.