3 ms·
Some serious questions: 1. Why not just use fs.writeFile to create all the site info as json files as either a one off or a chron job, then run a gulp task to
by Dr_tldr 11y ago
Some serious questions:
1. Why not just use fs.writeFile to create all the site info as json files as either a one off or a chron job, then run a gulp task to either use something like jade or else roll your own rendering to put the JSON in the right place on the page, then output the result as html to a public folder, set up an express static server and have a catch-all splat after it for 404s? What am I missing here?
2. If your site is fairly static like WeWork's, why not just have it as a SPWA, set all the links to retrieve a JSON file from the static server and process them on the front end? You could even use history.pushState and checking window.url to make sure that history works and links would load the right thing.
3. When someone logs in, are you doing a DB lookup then serving their dashboard page statically (somehow, for some reason...), or does this static build only apply to part of your page and not others?
4. Could everything Roots does be replaced by one 6 line gulp task? Not trying to be mean, just wondering if its target userbase knows what gulp is.
- bobfunk 11y agoFor point 1 - that will give you way worse performance than WeWork's current setup, since all requests will have to go back to your origin where your express server is running in order to determine if it's a static request or a dynamic request. With netlify this happens at the CDN PoP which makes a huge difference for a site with a global audience like WeWork.
- Dr_tldr 11y agoSure, but that's not an advantage unique to netlify, is it? I mean, one could run the express server on Amazon CloudFront and have the same situation and a more competitive pricing structure. Or is there something else they do that I'm missing?