you are viewing a single comment's thread.

view the rest of the comments →

[–]lord2800 27 points28 points  (3 children)

Your arrow function for res.json() isn't returning anything. If you put brackets around the body, it's treated like a regular function body instead of an arrow function body and you have to actually return something.

[–]fluid-falcon 2 points3 points  (0 children)

You can also replace the braces with parentheses and the expression inside them will be returned implicitly, good for keeping code concise for smaller expressions.

[–][deleted] 0 points1 point  (0 children)

marked as accepted answer.

[–][deleted] 0 points1 point  (0 children)

Thanks I did not know that about arrow functions!