Answer the question
In order to leave comments, you need to log in
How to use restructuring?
I watch the lesson, the person does the restructuring like this
app.post('/create',(request, response) => {
const {title, body} = request.body;
Post.create({
title: title,
body: body
}).then(post => console.log(post._id))
response.redirect('/');
});
const {title, body} = request.body;to restructure the data.
const {title, body} = request.body; SyntaxError: Unexpected token {and the arrow underlines the first parenthesis. What is the problem?
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