Skip to content

Commit

Permalink
model.js示例
Browse files Browse the repository at this point in the history
  • Loading branch information
bangbang93 committed Jun 20, 2017
1 parent 02c0b84 commit 0e5dfea
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
14 changes: 14 additions & 0 deletions model.js
@@ -0,0 +1,14 @@
/**
* Created by bangbang93 on 14-10-24.
*/
const Config = require('./config').database;
const Redis = require('ioredis');
const mongoose = require('mongoose');

mongoose.connect(`mongodb://${Config.mongodb.host}/${Config.mongodb.database}`);

mongoose.Promise = require('bluebird');

exports.redis = new Redis(Config.redis);

exports.mongoose = mongoose;
3 changes: 2 additions & 1 deletion package.json
Expand Up @@ -9,7 +9,6 @@
"start": "node bin/www",
"pm2": "pm2 startOrReload process.json",
"build": "NODE_ENV=production node script/build",
"postinstall": "npm run build",
"update": "npm run build && npm run pm2"
},
"dependencies": {
Expand All @@ -24,7 +23,9 @@
"express-promise-router": "^1.1.1",
"express-session": "^1.15.3",
"express-simple-route": "^1.4.2",
"ioredis": "^3.1.1",
"moment": "^2.18.1",
"mongoose": "^4.10.7",
"morgan": "^1.7.0",
"redis": "^2.7.1",
"serve-favicon": "^2.3.2"
Expand Down

0 comments on commit 0e5dfea

Please sign in to comment.