https://github.com/coderofsalvation/dpd-filebased-mongodb
run deployd without mongodb (but a jsonfile instead to store data)
https://github.com/coderofsalvation/dpd-filebased-mongodb
Last synced: about 1 year ago
JSON representation
run deployd without mongodb (but a jsonfile instead to store data)
- Host: GitHub
- URL: https://github.com/coderofsalvation/dpd-filebased-mongodb
- Owner: coderofsalvation
- Created: 2016-11-19T12:43:08.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2020-05-28T18:49:03.000Z (about 6 years ago)
- Last Synced: 2025-04-06T00:13:48.021Z (about 1 year ago)
- Language: JavaScript
- Size: 6.84 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
Awesome Lists containing this project
README
run deployd without mongodb (but a jsonfile instead to store data)

## Usage
$ npm install dpd-filebased-mongodb mongo-mock --save
$ mkdir data
$ export MONGO_DB_FILE=data/mongo.js
$ node app.js
Now make sure you include it *before* deployd itself in your `app.js`:
require('dpd-filebased-mongodb') // <-- magic right there
var deployd = require('deployd')
var dpd = deployd({port:3000});
dpd.listen();
> That's it! Now your data is stored in `data/mongodb.js`
## Why
* Sometimes you want to use deployd for simple api's without the mongodb-requirement.
* Sometimes you want to test deployd with a fake mongodb
## Notes
* to specify a different dbfile, specify environment variable `MONGO_DB_FILE="data/foo.js"` etc
* it doesn't run *all* mongo-queries, see [mongo-mock](https://npmjs.org/package/mongomock)
* because of this, `hide(field)` doesn't always work (solution: put `if( this.password ) delete this.password` into event-code)