mirror of
https://github.com/seigler/graphql-playground
synced 2025-07-27 01:26:10 +00:00
feat(server): add mutations, store data on mongoDB
This commit is contained in:
parent
62b1a67be7
commit
fae058cc68
3 changed files with 67 additions and 25 deletions
9
server/models/author.js
Normal file
9
server/models/author.js
Normal 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
10
server/models/book.js
Normal 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);
|
Loading…
Add table
Add a link
Reference in a new issue