Update
This commit is contained in:
parent
b92456d8d3
commit
b6130a7268
29 changed files with 16 additions and 779 deletions
20
app/models/mongodb.model.js
Normal file
20
app/models/mongodb.model.js
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
const dbConfig = require("../config/mongodb.config");
|
||||
const mongoose = require("mongoose");
|
||||
mongoose.Promise = global.Promise;
|
||||
|
||||
const db = {};
|
||||
db.mongoose = mongoose;
|
||||
|
||||
if(typeof process.env.NODE_ENV !== 'undefined' && process.env.NODE_ENV === 'production'){
|
||||
db.url = dbConfig.prodUrl;
|
||||
} else {
|
||||
db.url = dbConfig.devUrl;
|
||||
}
|
||||
|
||||
db.users = require("./user.model")(mongoose);
|
||||
db.playlists = require("./playlist.model")(mongoose);
|
||||
db.ads = require("./ad.model")(mongoose);
|
||||
db.histories = require("./history.model")(mongoose);
|
||||
|
||||
|
||||
module.exports = db;
|
||||
Reference in a new issue