0.1.2 • Published 8 years ago
mongod-run2 v0.1.2
mongod-run2
Simplifies running mongod within MEAN / Express projects. It can also be useful when testing APIs.
This is a fork of gtramontina/mongod-run where all the real work was done. Unfortunately, there were some changes in Node 7.x that broke the original package.
Express Example
var mongodRun2 = require('mongod-run2');
if(!isProduction) {
  mongodRun2.start(() => {
    this.doAfterMongoStart();
  })
}
else {
  this.doAfterMongoStart();
}Testing Example
var mongod = require('mongod-run');
before(mongod.start);
after(mongod.stop);
describe('my app', function () {
  // ...
});API
start(callback): runs mongod and call the callback once it is up and running.stop(): kills the mongod process. This is automatically called if/when the test process exits.
Notes
The mongod process is being ran with the following command:
$ mongod -f --restLicense
This is licensed under the feel-free-to-do-whatever-you-want-to-do license – http://unlicense.org