Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/mglagola/hapi-mongoose-connection

Simple mongoose plugin for hapi
https://github.com/mglagola/hapi-mongoose-connection

hapi middleware mongodb mongoose nodejs plugin

Last synced: 7 days ago
JSON representation

Simple mongoose plugin for hapi

Awesome Lists containing this project

README

        

# Hapi Mongoose Connection Plugin

## Install

**NPM**
```bash
$ npm install hapi-mongoose-connection --save
```

## Usage

```js
const HapiMongoose = require('hapi-mongoose-connection');
const Promise = require('bluebird');

const mongodbURI = process.env.MONGODB_URI;

const MongooseSetup = {
register: HapiMongoose,
options: {
uri: mongodbURI,
promise: Promise,
...any_mongoose_connection_options_here
},
};

...

server.register([
...
MongooseSetup,
...
], (err) => {
if (err) throw err;
...
});

```

## License

MIT