UNPKG

hulawho

Version:
34 lines (29 loc) 733 B
var mongoose = require('mongoose') var config = require('./config') var Game = require('../lib/index').Game mongoose.connect(config.mongo_url) mongoose.connection.on('connected', function(){ console.log("Connection to mongodb established") }) mongoose.connection.on('error', function(err){ console.log(err) }) mongoose.connection.on('disconnected', function(){ console.log("Connection to mongodb disconnected") }) var gameProfile = { home_team: 'Germany', away_team: 'Mexico', date: new Date('2018-06-17 14:31:34.599Z'), tournament: 'WC2018', round: 'group', cluster: 'F' } var game = new Game(gameProfile) game.addGame(function(err, res) { if(err) { console.log(err) return } console.log(res) })