Auto load mongoose models for Hapi.js
$ npm install hapi-mongoose-models
const Hapi = require('hapi');
const Mongoose = require('mongoose');
const server = Hapi.server({ port: 80 });
const provision = async () => {
await server.register({
plugin: require('hapi-mongoose-models'),
options: {
globPattern: './server/models/**/*.js', // Required
globOptions: { // https://github.com/isaacs/node-glob
cwd: __dirname, // Required
nosort: true // Optional, utils for mongoose descriptors
}
}
};
await server.start();
console.log('Server running at:', server.info.uri);
};
provision();
Run comand make test
or npm test
. Include 100% test coverage.
MIT