hapi-xhr

1.0.2 • Public • Published

hapi-xhr

npm version

Add xhr property to a request object of hapi.

install

npm install hapi-xhr

Usage

var Hapi = require('hapi');
var HapiXhr = require("hapi-xhr");

var server = new Hapi.Server();
server.connection({ 
    host: 'localhost', 
    port: 8000 
});

server.register(HapiXhr, function(err) {

  server.route({
    method: 'GET',
    path: '/test',
    handler: function(request, reply) {
      if (request.xhr) {
        return reply({ status: 'xhr' });
      }
      return reply({ status: 'not xhr' });
    }
  });

  server.start(function () {
    console.log('Server running at:', server.info.uri);
  });

});

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.2
    1
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.2
    1
  • 1.0.1
    0
  • 1.0.0
    0

Package Sidebar

Install

npm i hapi-xhr

Weekly Downloads

1

Version

1.0.2

License

ISC

Last publish

Collaborators

  • bells17