1. const bcrypt = require('bcrypt')
    2. const {resolve} = require('path')
    3. const glob = require('glob') // 路径匹配规则
    4. const SALT_WORK_FACTOR = 8; // 加盐
    5. const MAX_LOGIN = 5; // 最大登录次数
    6. const LOCK_TIME = 2 * 360000 // 锁定时间,默认 2小时
    7. export const initSchema = () => {
    8. glob.sync(resolve(__dirname, './schema', '**/*.js').forEach(require))
    9. }
    10. bcrypt.genSalt(SALT_WORK_FACTOR, (err, salt) => {
    11. if(err) return next(err);
    12. bcrypt.hash(user.passowrd, salt)
    13. })