Advertisement
Guest User

Untitled

a guest
Oct 30th, 2014
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /**
  2.  * Created by student on 30.09.2014.
  3.  */
  4. var coursesRoutes = require('../routes/courses')
  5.     , db = require('../models');
  6.  
  7. module.exports.name = 'courses';
  8. module.exports.require = ['users'];
  9. module.exports.init = function(app, modules, events) {
  10.     // dev configuration
  11.     if (app.get('env') === 'development') {
  12.         db.Course.destroy({}, {truncate: true}).success(function(err) {
  13.             db.Course.create({
  14.                 name: "First course",
  15.                 beginAt: new Date('21 May 2011'),
  16.                 endAt: new Date('21 May 2012')
  17.             });
  18.             db.Course.create({
  19.               name: "Second course",
  20.               beginAt: new Date('21 May 2010'),
  21.               endAt: new Date('21 May 2011')
  22.             });
  23.         });
  24.     }
  25.     app.use('/courses', coursesRoutes);
  26. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement