feat(server): add mutations, store data on mongoDB

This commit is contained in:
Joshua Seigler 2020-01-29 00:48:16 -05:00
parent 62b1a67be7
commit fae058cc68
3 changed files with 67 additions and 25 deletions

9
server/models/author.js Normal file
View file

@ -0,0 +1,9 @@
const mongoose = require('mongoose');
const { Schema } = mongoose;
const authorSchema = new Schema({
name: String,
age: Number
});
module.exports = mongoose.model('Author', authorSchema);

10
server/models/book.js Normal file
View file

@ -0,0 +1,10 @@
const mongoose = require('mongoose');
const { Schema } = mongoose;
const bookSchema = new Schema({
name: String,
genre: String,
authorId: String
});
module.exports = mongoose.model('Book', bookSchema);