【问题标题】:Is it possible to use Bcrypt in a backbone app without requiring it in the js file?是否可以在骨干应用程序中使用 Bcrypt 而无需在 js 文件中使用它?
【发布时间】:2015-07-01 18:58:25
【问题描述】:

在 bcrypt 文档中,它说您必须要求 bcrypt,例如:

`var bcrypt = require('bcrypt');
 bcrypt.genSalt(10, function(err, salt) {
     bcrypt.hash('B4c0/\/', salt, function(err, hash) {
         //Store hash in your password DB.
     });
});`

我在我的主干应用程序中使用 gulp。如果我在我的 javascript 文件中需要这样的 bcrypt,运行脚本函数需要 12 秒,因为我还实现了 browserify。 bcrypt 库必须加载到我的 app.js 中,这需要很长时间。

所以我想我可以在我的 Index.html 中的脚本标记中要求我的 Bcrypt,但是我无法访问 Bcrypt 函数,如 bcrypt.hash、bcrypt.hashSync、...

有没有办法在没有 var bcrypt = require('bcrypt') 的情况下使用 bcrypt?

【问题讨论】:

    标签: backbone.js gulp require browserify bcrypt


    【解决方案1】:

    也许使用node.js 版本;)

    【讨论】:

      猜你喜欢
      • 2021-09-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多