1.0.2 • Published 9 years ago

hapi-xhr v1.0.2

Weekly downloads
1
License
ISC
Repository
github
Last release
9 years ago

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);
  });

});
1.0.2

9 years ago

1.0.1

9 years ago

1.0.0

9 years ago