小编Jos*_*Joe的帖子

有没有版本的JSFiddle for Meteor?

有什么像JSFiddle for Meteor吗?很高兴能够分享我遇到的代码问题,以便其他人可以看到我的代码的客户端和服务器端以及看到它运行.

谢谢

meteor

5
推荐指数
1
解决办法
546
查看次数

Meteor up mup部署失败

编辑:在Github回购中打开问题. https://github.com/arunoda/meteor-up/issues/87

我试图设置Meteor来运行流星应用程序.

这是我跑步时得到的错误 mup deploy

调用部署过程:FAILED

    -----------------------------------STDERR-----------------------------------
    e-gyp/bin/node-gyp.js" "rebuild"
    gyp ERR! cwd /opt/give/tmp/bundle/programs/server/node_modules/bcrypt
    gyp ERR! node -v v0.10.28
    gyp ERR! node-gyp -v v0.13.0
    gyp ERR! not ok
    npm ERR! bcrypt@0.7.8 install: `node-gyp rebuild`
    npm ERR! Exit status 1
    npm ERR!
    npm ERR! Failed at the bcrypt@0.7.8 install script.
    npm ERR! This is most likely a problem with the bcrypt package,
    npm ERR! not with npm itself.
    npm ERR! Tell the author that this fails on your system:
    npm ERR! …
Run Code Online (Sandbox Code Playgroud)

bcrypt node-gyp meteor

5
推荐指数
1
解决办法
2022
查看次数

如何从另一个Meteor.call中的Meteor.call方法返回错误

我的流星代码在某些方面深入了解了几个Meteor.call方法.如果我在第二层有错误,我想将流星错误扔回客户端,我该怎么办呢?

目前我有这样的事情,但我的输出很混乱,我不认为我完全理解当我打电话时发生的事情 throw new Meteor.Error(500, e.category_code, e.description);

在client.js中

Meteor.call('firstCall', data, function (error, result) {
  if(result) {
    doSomething();
  }
  else{
    console.log(error);//just shows 500
  }
});
Run Code Online (Sandbox Code Playgroud)

在server.js中

var Future = Meteor.npmRequire("fibers/future");

function extractFromPromise(promise) {
    var fut = new Future();
    promise.then(function (result) {
        fut.return(result);
    }, function (error) {
        console.log(error);
        fut.throw(error);
    });
    return fut.wait();
}

firstCall: function (data){
  try{
    Meteor.call('secondCall', data, 'http://testhref.com/test', 'http://testhref2.com/test' function (error, result) {
      return result;
    });
  }
  catch(e){
    throw new Meteor.Error(500, e.category_code, e.description);
  }
}

secondCall: function (data, paymentHref, otherHref){ …
Run Code Online (Sandbox Code Playgroud)

meteor

5
推荐指数
1
解决办法
3263
查看次数

MongoDB检查属性是否存在(以及子属性)

是否有更传统的方法来检查MongoDB文档中是否存在属性和子属性?

现在我这样做是为了确保当其中一个属性或整个文档不存在时它不会出错.

//Check to see if the document exists
if(Donate.findOne({'debit.id': debitID})) { 
    //Check to see if the document has the property "credit"
    if(Donate.findOne({'debit.id': debitID}).credit){ 
        //Check to see if the object credit has the property sent
        if(!Donate.findOne({'debit.id': debitID}).credit.sent){
            doSomething();
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

!Donate.findOne({'debit.id': debitID}).credit.sent是看看sent是否设置为true.如果是,我不想执行doSomething();

mongodb meteor

4
推荐指数
1
解决办法
3901
查看次数

meteor的http.post API中基本身份验证的参数名称是什么?

我在meteor中使用HTTP.post,我需要只使用用户名向外部服务发送基本身份验证.这是怎么回事?看起来会是什么样的?

我只在服务器端使用它,所以我知道它应该看起来像下面的代码,但我不知道在哪里放置用户名和什么叫它.

我试过这个.

var resultSet = HTTP.post("https://billy.balancedpayments.com/v1/customers", {
    params: {"processor_uri": "/customers/customerURI"},
    authentication: {"MYKEYHERE":""}
});
Run Code Online (Sandbox Code Playgroud)

还有这个.

var resultSet = HTTP.post("https://billy.balancedpayments.com/v1/customers", {
    params: {"authentication": "MYKEYHERE",
    "processor_uri": "/customers/customerURI"}
});
Run Code Online (Sandbox Code Playgroud)

还有这个.

var resultSet = HTTP.post("https://billy.balancedpayments.com/v1/customers", {
    params: {"processor_uri": "/customers/customerURI"
    },
    headers: {'Authorization': 'MYKEYHERE'}
});
Run Code Online (Sandbox Code Playgroud)

我每次都会收到此错误.

Error: failed [403] 403 Forbidden  Access was denied to this resource. 
Unauthorized: CustomerIndexView failed permission check
Run Code Online (Sandbox Code Playgroud)

meteor

2
推荐指数
1
解决办法
2075
查看次数

如何使用 API 路由在 Next.js 上下载文件

我正在使用 next.js。我有一个第 3 方服务,我需要从中检索 PDF 文件。该服务需要一个我不想在客户端公开的 API 密钥。

这是我的文件

/api/getPDFFile.js ...

  const options = {
    method: 'GET',
    encoding: 'binary',
    headers: {
      'Subscription-Key': process.env.GUIDE_STAR_CHARITY_CHECK_API_PDF_KEY,
      'Content-Type': 'application/json',
    },
    rejectUnauthorized: false,
  };

  const binaryStream = await fetch(
    'https://apidata.guidestar.org/charitycheckpdf/v1/pdf/26-4775012',
    options
  );
  
  return res.status(200).send({body: { data: binaryStream}}); 


Run Code Online (Sandbox Code Playgroud)

页面/getPDF.js

   <button type="button" onClick={() => {
  fetch('http://localhost:3000/api/guidestar/charitycheckpdf',
    {
      method: 'GET',
      encoding: 'binary',
      responseType: 'blob',
    }).then(response => {
      if (response.status !== 200) {
        throw new Error('Sorry, I could not find that file.');
      }
      return response.blob();
    }).then(blob => {
      const …
Run Code Online (Sandbox Code Playgroud)

download next.js

2
推荐指数
1
解决办法
810
查看次数

标签 统计

meteor ×5

bcrypt ×1

download ×1

mongodb ×1

next.js ×1

node-gyp ×1