Code Monkey home page Code Monkey logo

connect-esi's Introduction

connect-esi

ESI tag processor for the connect framework

Introduction

The purpose of connect-esi is to provide simple Edge Side Includes (ESI) processing via a post request filter on top of the connect framework.

It works as follows:

  1. response.write behaviour is modified to search for esi:include tags
  2. if tags are found, each src attribute from the esi tag is fetched via http.get
  3. on http.get response, the original esi tag will be substituted with the content from the response
  4. when all esi tags have been substituted, the final page is displayed

This package is in its early stages and still needs some work. As with any of our projects, constructive criticism is encouraged.

Installing

Just grab node.js and npm and you're set:

npm install connect-esi

Note that connect-esi was developed using CoffeeScript.

Using

To utilize connect-esi, simply require it and then have the connect server use the setupESI() method. To make sure that no other modules conflict with connect-esi, it should be used by the connect server before other 'use' methods.

connectESI = require 'connect-esi'

server.use connectESI.setupESI()

Client Side Includes (csi)

esi-parser.js will loop through all esi and csi tags on a page and request relevant sources. This script depends on jQuery and PMScriptManger.js. It is currently coded to work with our timbits project (see https://github.com/Postmedia/timbits) in that it will append &esi_id=esi_id&remote=true to the esi/csi src and will expect a script to return. Look at the server source to see how the script response should be formatted (the contents of the response should be inserted into jQuery("#esi_id")).

Outstanding Issues

  • none at this time

Created by

  • Stephen Veerman

connect-esi's People

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.