Skip to content

Commit 04ed112

Browse files
authored
Setup Mongoose and Win model (#2)
1 parent 2c6380a commit 04ed112

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,10 @@
1818
"test-reload": "nodemon --exec mocha"
1919
},
2020
"dependencies": {
21+
"cron": "^1.1.0",
2122
"koa": "^1.2.1",
2223
"koa-bodyparser": "^2.2.0",
23-
"cron": "^1.1.0",
24+
"mongoose": "^4.5.7",
2425
"slackbots": "^0.5.1"
2526
},
2627
"devDependencies": {

src/Win.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
'use strict'
2+
3+
const mongoose = require('mongoose')
4+
5+
const WinSchema = mongoose.Schema({
6+
author: String,
7+
channel: String,
8+
win: String
9+
})
10+
11+
module.exports = mongoose.model('Win', WinSchema)

src/index.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ const TwigBot = require('./TwigBot')
44
const MessageScheduler = require('./MessageScheduler')
55
const koa = require('koa')
66
const bodyParser = require('koa-bodyparser')
7+
const mongoose = require('mongoose')
8+
9+
mongoose.Promise = global.Promise
10+
mongoose.connect(process.env.MONGO_URI)
711

812
const app = koa()
913
const port = process.env.PORT || 3000

0 commit comments

Comments
 (0)