hapi-accept-language
v1.0.1
Published
automagically parses the accept-language header
Downloads
58
Keywords
Readme
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');
});
});