Use :
instead of =
see the example below that gives an error
app.post('/mews', (req, res) => {
if (isValidMew(req.body)) {
// insert into db
const mew = {
name = filter.clean(req.body.name.toString()),
content = filter.clean(req.body.content.toString()),
created: new Date()
};
That gives Syntex Error: invalid shorthand proprty initializer.
Then i replace =
with :
that's solve this error.
app.post('/mews', (req, res) => {
if (isValidMew(req.body)) {
// insert into db
const mew = {
name: filter.clean(req.body.name.toString()),
content: filter.clean(req.body.content.toString()),
created: new Date()
};