1.0.2 • Published 9 years ago

hapi-plug-routes v1.0.2

Weekly downloads
1
License
MIT
Repository
github
Last release
9 years ago

hapi-plug-routes

Build StatusDependency Statusnpm version

NPM

What is hapi-plug-routes?

A simple npm module to register routes contained in separated files from a specific folder. Sub-folders will work as well.

By registering this plugin you will be able to specify a folder that contains .js files with hapi.js routes which will then automatically become available to the server.

Usage

$ npm i hapi-plug-routes --save

/src/routes/helloWorld.js

module.exports = {
    method: 'GET',
    path: '/',
    handler: function (request, reply) {
        reply('Hello, World!');
    }
};

/app.js

server.register([
    {
        register: require('hapi-plug-routes'),
        options: {
            directory: '/src/routes/'
        }
    }
], function(err) {
    if (err) {
        console.error('Failed to load plugin:', err);
    }

    server.start();
});

Configuration

  • directory (default: '/src/routes') - path to directory containing routes

Release History

  • v1.0.0 (2015-05-24)
    • initial release
  • v1.0.1 (2015-05-26)
    • added default for the 'directory' option
  • v1.0.2 (2015-09-13)
    • updated dependencies
1.0.2

9 years ago

1.0.1

9 years ago

1.0.0

9 years ago

0.1.6

9 years ago

0.1.5

9 years ago

0.1.4

9 years ago

0.1.3

9 years ago

0.1.2

9 years ago

0.1.1

9 years ago

0.1.0

9 years ago