1.0.2 • Published 4 years ago

pjax-parser v1.0.2

Weekly downloads
6
License
MIT
Repository
github
Last release
4 years ago

PJAX-Parser

Express middleware to handle pjax requests

npm version Code Climate GitHub license

Installation

npm install pjax-parser --save

Usage

import express from 'express';
import path from 'path';
import bodyParser from 'body-parser';
import pjaxParser from 'pjax-parser';

const app = express();
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: false }));

app.set('view engine', 'hbs');
app.set('views', path.join(__dirname, 'views'));
app.use(express.static(path.join(__dirname, 'public')));

app.use(pjaxParser());

app.get('/', (req, res) => {
  res.render('index', {data: 'test'});
});

app.get('/about', (req, res) => {
  res.render('about', {data: 'test'});
});

app.listen(3000, () => {
  console.log("listening at http://localhost:3000")
});

Development

The source code is in lib dir. Use gulp build to transpile code to ES5 using babel. Use gulp watch to watch for continuous build.

LICENSE

MIT