Nifty Purring Manticore

    hapi-accept-language

    1.0.1 • Public • Published

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

    Keywords

    Install

    npm i hapi-accept-language

    DownloadsWeekly Downloads

    6

    Version

    1.0.1

    License

    MIT

    Last publish

    Collaborators

    • arnoldzokas
    • matteofigus
    • ryantomlinson
    • andyroyle
    • federicomaffei