diff options
author | Mateja <mail@matejamaric.com> | 2021-05-03 00:56:35 +0200 |
---|---|---|
committer | Mateja <mail@matejamaric.com> | 2021-05-03 00:56:35 +0200 |
commit | 3460f9ad874495469cfa8d4aaa42b66f5e427bf2 (patch) | |
tree | 5595313907d53ee8bcb5f3e8ca684b7a44126ee2 /models | |
parent | c2649bfff51a175508685e493d8bfae4713cda16 (diff) | |
download | node-playground-3460f9ad874495469cfa8d4aaa42b66f5e427bf2.tar.gz node-playground-3460f9ad874495469cfa8d4aaa42b66f5e427bf2.zip |
Use MongoDB (with Mongoose) to store posts.
Diffstat (limited to 'models')
-rw-r--r-- | models/post.js | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/models/post.js b/models/post.js new file mode 100644 index 0000000..3f341d1 --- /dev/null +++ b/models/post.js @@ -0,0 +1,10 @@ +const mongoose = require('mongoose'); + +const postSchema = new mongoose.Schema({ + title: String, + text: String +}); + +const postModel = mongoose.model('post', postSchema); + +module.exports = postModel; |