forked from freeCodeCamp/freeCodeCamp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Major refactor. Add error handlers everywhere.
- Loading branch information
Berkeley Martinez
authored and
Berkeley Martinez
committed
Dec 23, 2014
1 parent
e921b63
commit 86fcfe8
Showing
18 changed files
with
1,432 additions
and
1,530 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,29 @@ | ||
var mongoose = require('mongoose'); | ||
var secrets = require('./secrets'); | ||
var mongoose = require('mongoose'), | ||
debug = require('debug')('freecc:config:boot'), | ||
secrets = require('./secrets'), | ||
courses = require('../seed_data/courses.json'), | ||
Course = require('./../models/Course'), | ||
challenges = require('../seed_data/challenges.json'), | ||
Challenge = require('./../models/Challenge'); | ||
|
||
mongoose.connect(secrets.db); | ||
mongoose.connection.on('error', function() { | ||
console.error('MongoDB Connection Error. Make sure MongoDB is running.'); | ||
}); | ||
|
||
var courses = require('../seed_data/courses.json'); | ||
var challenges = require('../seed_data/challenges.json'); | ||
|
||
Challenge = require ('./../models/Challenge'); | ||
Course = require ('./../models/Course'); | ||
|
||
Course.create(courses, function(err, data) { | ||
if (err) console.log(err); | ||
else console.log('Saved ', data ); | ||
if (err) { | ||
debug(err); | ||
} else { | ||
debug('Saved ', data); | ||
} | ||
}); | ||
|
||
Challenge.create(challenges, function(err, data) { | ||
if (err) console.log(err); | ||
else console.log('Saved ', data ); | ||
}); | ||
if (err) { | ||
console.log(err); | ||
} else { | ||
console.log('Saved ', data); | ||
} | ||
}); |
Oops, something went wrong.