|
|
|
|
|
by jmstout
4385 days ago
|
|
Doesn't this method of including dynamic data in the index.html page prevent it being served from a CDN? When serving a web application, I'm generally more worried about the time it takes before the user sees a response, even if the page isn't fully hydrated yet, than the total load time. Requiring a hit to the database before the index.html is served seems like a bad idea to me, even if it is 'saving' a request to the API. |
|
if your cdn is serving static html pages then yeah probably. If it's just serving assets like images/js/css/fonts, it shouldn't be an issue since those would all be extra reqs anyway, and not "compiled" into the html.
I serve up all my angular view templates as static files (ui-router), use ng-include for dumb stuff like footer text that never changes, and rely on the API (hmac) for populating content.
Perhaps this is over opinionated, but angular seems to me to be designed so that you don't have to do ANY view templating bullshit on the server. I don't have a single angular app that hits the app server for an html template compiled by code. In fact the only thing I do serverside templating in now is drupal.