This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
Throw uncaught errors to the next middleware automatically | |
and avoid having to use try/catch in the controller methods | |
router.get('/', asyncRequest(controller.index)); | |
with asyncRequest... | |
index: async(req, res) => { | |
const data = await Model.findAll(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const assert = (...args) => { | |
this.args = args | |
return { | |
equals: (arg) => { | |
console.log(`${this.args.join(' + ')} = ${arg}`) | |
return this.args | |
} | |
} | |
return this; |
OlderNewer