Slide 6
Slide 6 text
$PQZSJHIU© :BIPP+BQBO$PSQPSBUJPO"MM3JHIUT3FTFSWFE
&4-PWF
exports.get = async (req, res) => {
const { permission } = checkRole(req)
if (!permission) {
throw new AuthError('permission error')
}
const { id, name } = req.query
const where = db.getQuery(id, name)
const { office } = await db.getOffice(where)
return { status: 200, office }
}
本当はまだ大部分がgenerator + co (開発時はv4
https://techblog.yahoo.co.jp/javascript/nodejs/Node-es6/
設計
・フロー制御はasync/await
・Node.js v8に上げても動いた!