Skip to content

Instantly share code, notes, and snippets.

Created July 28, 2017 03:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/e77064ae71b5ef6d5a9abfd897187ddf to your computer and use it in GitHub Desktop.
Save anonymous/e77064ae71b5ef6d5a9abfd897187ddf to your computer and use it in GitHub Desktop.
/**
* 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