plugin to wrap accept-language-parser
Switch branches/tags
Nothing to show
Clone or download
federicomaffei Merge pull request #2 from federicomaffei/master
peer dependency on hapi less strict
Latest commit 314e8b2 Mar 8, 2016
Permalink
Failed to load latest commit information.
tests inital commit May 1, 2015
.gitignore inital commit May 1, 2015
.jshintrc inital commit May 1, 2015
.travis.yml inital commit May 1, 2015
Gruntfile.js inital commit May 1, 2015
LICENSE inital commit May 1, 2015
README.md inital commit May 1, 2015
index.js inital commit May 1, 2015
package.json version bump Mar 8, 2016

README.md

#Hapi-accept-language Build Status NPM version Dependencies

Hapi plugin for automagically parsing the accept-language header, and populating request.pre.language.

Uses the accept-language-parser module under the hood

installation:

npm install hapi-accept-language

usage:

var hapi = require("hapi");

var server = new hapi.Server({});

server.connection({ port: 3000 });

server.route([{
  method: 'GET',
  path: '/my-url',
  config: {
    handler: function(request, reply){
      reply(request.pre.language)
    }
  }
}]);

server.register([
  require('hapi-accept-language'),
  ], function(err){
    if(err){
      throw err;
    }

    server.start(function(){
      server.log('server started');
    });
});