Answer the question
In order to leave comments, you need to log in
How to send a request from the front to change the database?
On the front, I have a React/Redux application for adding cards, and each card has an unlimited number of entries.
The Redux store has an array of cards and entries, and the usual actions: addCard, deleteCard, editCard, addEntry, deleteEntry, editEntry.
const rootReducer = combineReducers({
cards: CardReducer,
entries: EntryReducer,
});
const todoSchema = new mongoose.Schema({
cards: {type: Array, required: true},
entries: {type: Array, required: true},
createdAt: {type: Date, default: Date.now}
});
axios.post(API_URL, {cards, entries})
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question