依赖引入
'use strict';
const crypto = require('crypto');
class HomeController {
async md5Ceshi() {
let = str = 'asdasdasdasda';
str = crypto.createHash('md5').update(str).digest('hex');
ctx.body = str;
}
}
module.exports = HomeController;
注:
如果报错不存在依赖,则添加如下依赖
npm i crypto --save