Typing/Lesson 25 of 27

Code

JavaScript snippets

Real code from your notes. After Enter, the indentation is typed for you.

0

WPM

100%

Accuracy

0%

Progress

// Express 4 helper↵
const asyncHandler = (fn) => (req, res, next) =>↵
Promise.resolve(fn(req, res, next)).catch(next)↵
↵
app.get('/orders', asyncHandler(async (req, res) => {↵
const orders = await Order.find({ userId: req.user.id })↵
res.json(orders)↵
}))

/: Right pinky