Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
@flexshopper/hapi-methods
Advanced tools
Readme
Plugin to autoload methods based on patterns.
hapi-methods
npm package in your project our plugin.
npm i @flexshopper/hapi-methods
const server = new Hapi.Server();
server.connection();
server.register({
register: require('hapi-methods'),
options: {
relativeTo: proccess.cwd() + '/methods',
includes: ['path/to/**/*methods.js'],
ignore: ['*.git'],
}
}, (err) => {
// continue application
});
manifest style:
registrations: [
...
{
plugin: {
register: 'hapi-methods',
options: {
relativeTo: proccess.cwd() + '/methods',
includes: ['path/to/**/*methods.js'],
ignore: ['*.git'],
}
}
}
];
Required
Type: array
The glob pattern you would like to include
Type: array
The pattern or an array of patterns to exclude
Type: string
The current working directory in which to search (defaults to process.cwd()
)
'use strict';
const internals = module.exports = {};
internals.myNewMethod = {
method: (next) => {
return next();
},
options: {
cache: {
expiresIn: 60000,
generateTimeout: 60000
}
}
};
internals.anotherMethod = {
// if method is defined as function(), 'this' value is bound to server instance
method: function(next) {
// 'this' is bound to server, thus it is equal to hapi server instance
expect(this.plugins).to.exist();
return next();
}
};
// This methods would be available as:
server.methods.methodFileName.myNewMethod();
server.methods.methodFileName.anotherMethod();
No matter what format your filenames are in, use camelcase to access the method.
For example, if a method file name is: foo-bar.js
, it has a method named myMethod() inside.
You can access this method as:
server.methods.fooBar.myMethod();
If internals.anotherMethod.method
is equal to regular function (non-arrow function)
'this' will be bound to instance of server
.
FAQs
Hapi plugin to autoload methods.
The npm package @flexshopper/hapi-methods receives a total of 7 weekly downloads. As such, @flexshopper/hapi-methods popularity was classified as not popular.
We found that @flexshopper/hapi-methods demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 7 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.