esi
v0.8.1
Published
Edge Side Includes processing for Client and Node environments
Downloads
11
Readme
Node ESI Language parser
Edge Side Includes (ESI) Language is a templating language supported by popular CDN's such as Akamai and Varnish. This NPM module will preprocess ESI tags within your node server environment.
Example
You want to embed the fragment of HTML from "http://snipets.com/abc.html" within an HTML document.
blah blah, oh and here i embed in the page a snipet using an ESI server ...
<esi:include src="http://snipets.com/snipet.html"></esi:include>
snipet.html
<b>Snipet</b>
With Node ESI script, you can pre-process ESI tags.
Include the script
npm install esi --save
Simply pass it into any service which uses http.createServer, e.g. below i'm using connect.
Add ESI as middleware
var app = require('connect')();
var esi = require('esi');
app.use( esi );
var srv = http.createServer(app).listen( 8080 );
Now the page is constructed and the response looks like this...
blah blah, oh and here i embed in the page a snipet using an ESI server ...
<b>Snipet</b>
Specs
View the ESI specs or from the install directory run.
mocha specs -R spec
Options
debug - prints out the tag handling
esi.debug = true;
vars - set/modify environment variables
esi.vars.HTTP_HOST = 'www.google.com';