Created
January 10, 2021 15:42
-
-
Save Daniel1984/5ab2281c702cebb5eba54d2b950a78e7 to your computer and use it in GitHub Desktop.
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
// middleware/getAccount.js | |
module.exports = async (req, res, next) => { | |
try { | |
const account = await req.db.Account.findByPk(req.body.account_id); | |
res.locals.account = account; | |
next(); | |
} catch (err) { | |
next(err); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment