1.3.5 • Published 7 years ago

hapi-mobile-detect v1.3.5

Weekly downloads
23
License
BSD-3-Clause
Repository
github
Last release
7 years ago

hapi-mobile-detect is a User-agent information plugin for hapi

hapi-mobile-detect is a fork of Scooter authored and maintained by Daniel Bretoi.

hapi-mobile-detect uses the mobile-detect package to provide user-agent information. For more details of what information hapi-mobile-detect provides, please see the mobile-detect web-page.

Usage

    const Hapi = require('hapi');
    const server = new Hapi.Server(8086);
    const MobileDetect = require('hapi-mobile-detect');

    server.route({
        method: 'GET',
        path: '/is-mobile',
        handler: (request, reply) => {

            return reply(request.plugins.md.mobile());
        }
    });

    server.register(MobileDetect, (err) => {

        server.start(() => {

            console.log(server.info.uri + '/is-mobile');
        });
    });