I was trying to add a new note to the quoteNotes table. However, after inserting it and logging the response, I noticed that there was no record of the inserted note showing up.
router.post('/:id/notes', (req, res) => {
const {id} = req.params;
const note = req.body;
note.quote_id = id
// if(note.note === "") return res.status(422)
// .json({message: 'Note cannot be empty'});
Quotes.addNote(note).then((quoteNote) => {
console.log(quoteNote)
res.status(200).json(quoteNote);
});
});
console.log =>
Result {
command: 'INSERT',
rowCount: 1,
oid: 0,
rows: [],
fields: [],
_parsers: undefined,
_types: TypeOverrides {
_types: {
getTypeParser: [Function: getTypeParser],
setTypeParser: [Function: setTypeParser],
arrayParser: [Object],
builtins: [Object]
},
text: {},
binary: {}
},
RowCtor: null,
rowAsArray: false
}