Created
July 28, 2017 03:22
-
-
Save anonymous/e77064ae71b5ef6d5a9abfd897187ddf to your computer and use it in GitHub Desktop.
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
/** | |
* Created by Borys on 20.07.2017. | |
*/ | |
var mongoose = require('mongoose'); | |
var postSchema = mongoose.Schema({ | |
username: { | |
type: String, | |
required: true | |
}, | |
body: { | |
type: String, | |
required: true | |
}, | |
date: { type: Date, | |
default: Date.now | |
} | |
}); | |
var Post = module.exports = mongoose.model('Post', postSchema); | |
// Get All Posts | |
module.exports.getPosts = function (callback, limit) { | |
Post.find(callback).limit(limit); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment