koa-request-pjax
A simple middleware to grab & set PJAX related headers
Installation
$ npm install koa-request-pjax --save
Usage
When this is a PJAX request, an object
is set on the koa request:
thisrequestpjax = container: '#content'
You can alter this object
to set PJAX response headers automatically:
// This will set the 'X-PJAX-URL' response headerthisrequestpjaxurl = "http://localhost:3000/foo/bar"; // This will set the 'X-PJAX-Version' response headerthisrequestpjaxversion = "v123";
Example
var koa = ;var pjax = ;var app = ; app;app; app;