1.3.2 • Published 4 years ago

@dukai.net/hapi-settings v1.3.2

Weekly downloads
-
License
MIT
Repository
github
Last release
4 years ago

hapi-settings

Helper plugin provide toolkit support to retrieve objects from application settings.

Install:

npm install @dukai.net/hapi-settings

or:

yarn add @dukai.net/hapi-settings

Use:

path: '/api/v1/orange/{id}',
method: 'GET',
handler: async (request, h) => {
    try {
        const dal = h.dal(request);   // Returns with the DAL object, which gives access to all repository object
        const args = h.args(request); // Combines all input from params, query and payload to a single object
        // do something with db object here
        return await dal.orange.getSomething(args);
    } catch (err) {
        return boom.boomify(err, { statusCode: 400 });
    }
},

All available methods:

// Under the hood the toolkit methods accessing the "request.server.settings.app" object where custom data stored
const dal = h.dal(request); // Data Access Layer object with all the repositories from all the plugins
const args = h.args(request); // Combines all input from params, query and payload to a single object
const plugins = h.plugins(request); // Returns the array of plugin names
const settings = h.settings(request); // Returns the object holding the above objects as well
1.3.2

4 years ago

1.3.1

4 years ago

1.3.0

4 years ago

1.2.0

4 years ago

1.1.1

4 years ago

1.1.0

4 years ago

1.0.4

4 years ago