Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including raptor-data-providers with all npm packages installed. Try it out:

var raptorDataProviders = require("raptor-data-providers")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

raptor-data-providers v1.0.1-beta

Module to support the optimized delivery of web application resources


The raptor-data-providers module provides support for the more efficient and simpler "Pull Model "approach to providing templates with view model data.

  • Push Model: Request all needed data upfront and wait for all of the data to be received before building the view model and then rendering the template.
  • Pull Model: Register data providers and immediately start rendering the template. Let the template pull the data needed during rendering.

The Pull Model approach to template rendering requires the use of a templating engine that supports asynchronous template rendering (e.g. raptor-templates and dust). This is because before rendering the template begins not all of data may have been fully retrieved. Parts of a template that depend on data that is not yet available are rendered asynchronously with the Pull Model approach.

Push Model versus Pull Model

The problem with the traditional Push Model approach is that template rendering is delayed until all data has been fully received. This reduces the time to first byte, and it also may result in the server sitting idle while waiting for data to be loaded from remote services. In addition, if certain data is no longer needed by a template then only the template needs to be modified and not the controller.

With the new Pull Model approach, template rendering begins immediately. In addition, fragments of the template that depend on data from data providers are rendered asynchronously and wait only on the associated data provider to complete. The template rendering will only be delayed for data that the template actually needs.

Simple Example

Register data providers upfront:

    weather: function(args, callback) {
        var zipcode = args.zipcode;
                zipcode: zipcode


RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free