Saturday 20 May 2017

Edge-Side Includes in Node and PHP

We are currently exploring microservices as our next architecture for a web app but we don't won't to limit that to the back-end. Self Contained Services (SCS) is what we want to implement, that means that the product is split in different components based on the business domain and contains all the back-end logic (REST API) and the front-end visualization (HTML, JS, CSS). Then, there are different pages comprised of many components. Each component belongs to a team, who is responsible for development and deployments, and NOT dependent on how other teams work. The problem is that the web app needs to be SEO optimized so including HTML on page load via async JS is not an option. I am looking for a way to do Edge-Side Includes (ESI) on the server (some pages are on Express Node server, others on Apache PHP), so the end result should be a pre-rendered page which looks something like this:

Server:
<esi:include src="http://snipets.com/get_component"></esi:include>

Client:
<script>some js</script>
<style>some css</style>
<div>some html</div>

There will be components included both in an Express Node app and Apache PHP



via Daniel Papukchiev

No comments:

Post a Comment