Skip to content

bells17/hapi-xhr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

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

});

About

Add xhr property to a request object of hapi.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published