All Projects â†’ jedireza â†’ hapi-mongo-models

jedireza / hapi-mongo-models

Licence: MIT license
📦 A hapi plugin for `mongo-models`

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to hapi-mongo-models

hapi-sentry
A hapi plugin for request error logging to Sentry
Stars: ✭ 24 (-76.24%)
Mutual labels:  hapi, hapi-plugin
hapi-docs
Beautiful API documentation generator for Hapi using Vue
Stars: ✭ 64 (-36.63%)
Mutual labels:  hapi, hapi-plugin
hapi-statsd
A hapi plugin for sending request round trip metrics to statsd
Stars: ✭ 29 (-71.29%)
Mutual labels:  hapi, hapi-plugin
hapi-sequelizejs
A hapi.js plugin to connect with Sequelize ORM
Stars: ✭ 56 (-44.55%)
Mutual labels:  hapi, hapi-plugin
hapi-plugin-mysql
Hapi plugin for MySQL
Stars: ✭ 17 (-83.17%)
Mutual labels:  hapi, hapi-plugin
hapi-now-auth
Hapi token auth for bearer and jwt
Stars: ✭ 43 (-57.43%)
Mutual labels:  hapi, hapi-plugin
hapi-dev-errors
A hapi plugin to return better error details and skip the look at command line to catch the issue.
Stars: ✭ 58 (-42.57%)
Mutual labels:  hapi, hapi-plugin
hapi-good-winston
A good reporter to send and log events with winston
Stars: ✭ 21 (-79.21%)
Mutual labels:  hapi, hapi-plugin
Hapi
The Simple, Secure Framework Developers Trust
Stars: ✭ 13,632 (+13397.03%)
Mutual labels:  hapi
good-sentry
Sentry broadcasting for good process monitor
Stars: ✭ 15 (-85.15%)
Mutual labels:  hapi
Hapijs.com
The hapijs.com website
Stars: ✭ 181 (+79.21%)
Mutual labels:  hapi
Hapi Universal Redux
DEPRECATED: Create an universal React and Redux app in less than 5 minutes!
Stars: ✭ 215 (+112.87%)
Mutual labels:  hapi
sapper-authentication-demo
A demonstration of Auth with Sapper + JWT + Server Side Rendering + RBAC
Stars: ✭ 102 (+0.99%)
Mutual labels:  hapi
Hapi Openapi
Build design-driven apis with OpenAPI (formerly swagger) 2.0 and hapi.
Stars: ✭ 196 (+94.06%)
Mutual labels:  hapi
trailpack-hapi
📦 Hapi.js Trailpack
Stars: ✭ 19 (-81.19%)
Mutual labels:  hapi
hapi-routes
Hapi plugin for registering routes
Stars: ✭ 12 (-88.12%)
Mutual labels:  hapi-plugin
H2o2
Proxy handler for hapi.js
Stars: ✭ 158 (+56.44%)
Mutual labels:  hapi
Cls Rtracer
Request Tracer - CLS-based request id generation for Express, Fastify, Koa and Hapi, batteries included
Stars: ✭ 175 (+73.27%)
Mutual labels:  hapi
Inert
Static file and directory handlers for hapi.js
Stars: ✭ 236 (+133.66%)
Mutual labels:  hapi
Hapi React Views
📦 A hapi view engine for React components
Stars: ✭ 234 (+131.68%)
Mutual labels:  hapi

hapi-mongo-models

A hapi plugin for mongo-models.

Build Status Dependency Status devDependency Status peerDependency Status

Install

$ npm install hapi-mongo-models

Server plugin

During plugin registration we connect to MongoDB using the supplied options.

During Hapi's onPreStart server extension point and based on your autoIndex option, we create any indexes defined in the models supplied.

Register

const HapiMongoModels = require('hapi-mongo-models');

const plugin = {
    plugin: HapiMongoModels,
    options: {
        mongodb: {
            connection: {
                uri: 'mongodb://localhost:27017/',
                db: 'hapi-mongo-models-test'
            },
            options: {}
        },
        models: [
            './path/to/customer',
            './path/to/order'
        ],
        autoIndex: false
    }
};

await server.register(plugin);

Plugin options

The options passed to the plugin is an object where:

  • mongodb - is an object where:
    • connection - is an object where:
      • uri - a string representing the connection uri for MongoDB.
      • db - the name of the database.
    • options - an optional object passed to MongoDB's native connect function.
  • autoIndex - a boolean specifying if the plugin should call createIndexes for each model that has a static indexes property. Defaults to true. Typically set to false in production environments.
  • models - an array strings representing the paths to the models (relative to the current working directory or absolute) of where to find the model on disk.

Have a question?

Any issues or questions (no matter how basic), open an issue. Please take the initiative to read relevant documentation and be pro-active with debugging.

Want to contribute?

Contributions are welcome. If you're changing something non-trivial, you may want to submit an issue before creating a large pull request.

Note: This plugin is designed for basic use-cases. If you find yourself needing more, consider using the source as inspiration and create a custom plugin for your app.

License

MIT

Don't forget

What you create with hapi-mongo-models is more important than hapi-mongo-models.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].