UNPKG

@contentacms/contentajs

Version:

A nodejs server that proxies to Contenta CMS and holds custom code.

36 lines (32 loc) 2.08 kB
<!-- This file was generated by emdaer Its template can be found at .emdaer/docs/subrequests.emdaer.md --> <!-- emdaerHash:ec34d2c8e198aafe0c6235d5cf245548 --> <h1 id="contentajs-img-align-right-src-logo-svg-alt-contenta-logo-title-contenta-logo-width-100-">ContentaJS <img align="right" src="./logo.svg" alt="Contenta logo" title="Contenta logo" width="100"></h1> <h1 id="subrequests">Subrequests</h1> <p>Subrequests is a request aggregator project that will allow you to turn multiple requests into a single one. To do so client-side applications describe the requests they want to do in a JSON document and send that document to the server. In turn, the server interprets that document, called <em>blueprint</em>, and executes all the those requests in the clients behalf.</p> <p>There are two big benefits when using this approach:</p> <ul> <li>There is only one round trip between server an client. The client to server communications may be weak (ex: over 3G), but the server to server communications are always very reliable.</li> <li>If your requests are resolved by the same server processing the blueprints, you eliminate completaly the latency introduced by sequential requests. That introduces a dramatic performance improvement.</li> </ul> <p>Subrequests is implemented as a <a href="https://www.drupal.org/project/subrequests">Drupal module</a> and as an <a href="https://github.com/e0ipso/subrequests-express">express middleware</a>. ContentaJS relies on the nodejs implementation of the <a href="http://cgit.drupalcode.org/subrequests/tree/SPECIFICATION.md">Subrequests specification</a>, which is exposed in the <code>/subrequests</code> route.</p> <p>If you want to learn more about how your client side applications can use subrequests to reduce communications latency and improve application performance read <a href="https://www.lullabot.com/articles/incredible-decoupled-performance-with-subrequests">this article</a> or watch <a href="https://events.drupal.org/nashville2018/sessions/decoupled-drupal-hard-problems">this presentation</a>.</p>