Permalink
Browse files

Step 10: Add MongooseJS model

  • Loading branch information...
vkarpov15 committed Jul 25, 2013
1 parent 194efcf commit 0772a8b15898b671fb156f333e3ba4a9cca2e29d
Showing with 10 additions and 0 deletions.
  1. +3 −0 app.js
  2. +7 −0 models/Todo.js
View
3 app.js
@@ -14,6 +14,9 @@ var app = express();
var Mongoose = require('mongoose');
var db = Mongoose.createConnection('localhost', 'mytestapp');
var TodoSchema = require('./models/Todo.js').TodoSchema;
var Todo = db.model('todos', TodoSchema);
// all environments
app.set('port', process.env.PORT || 3000);
app.set('views', __dirname + '/views');
View
@@ -0,0 +1,7 @@
var Mongoose = require('mongoose');
exports.TodoSchema = new Mongoose.Schema({
description : { type : String, required : true },
due : { type : Date, required : true },
done : { type : Boolean, default : false }
});

0 comments on commit 0772a8b

Please sign in to comment.