Skip to content

exculibar/koa-pjax

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 

Repository files navigation

koa-pjax

A middleware enable to use of PJAX in koa.

Install

npm install koa-pjax

Usage

Demo: koa-pjax-demo

var koa = require('koa');
var staticServer = require('koa-static');
var path = require('path');
var app = koa();
var pjax = require('koa-pjax');
var views = require('co-views');
var render = views(__dirname + '/../views', {
    map: { html: 'swig' }
});
var route = require('koa-route');
app.use(pjax());
app.use(staticServer(path.join(__dirname, 'static')));
app.use(route.get('/', p1));
app.use(route.get('/2', p2));

function *p1() {
    this.body = yield render('p1');
}

function *p2() {
    this.body = yield render('p2');
}

app.listen(3000);

About

A middleware enable to use of PJAX in koa.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published