Tag: meteor

meteor服务器中的asynchronousfunction

我正在使用vpulim:node-soap来运行soap服务器。 我的meteor服务器启动包含其中各种其他代码: authRequestOperation: function(args,cb,headers,req) { console.log(args); var authResponceObject = {}; var futureAuthResponse = new Future(); Fiber(function(){ if(collectorUsers.findOne({username: args.username})){ console.log("Found User"); authResponceObject = { username: args.username, nonce: Random.id() }; console.log("authResponceObject is: " + JSON.stringify(authResponceObject,null,4)); console.log("futureAuthResponse returning…"); futureAuthResponse.return(authResponceObject); } // console.log("futureAuthResponse waiting…"); // return futureAuthResponse.wait(); }).run(); console.log("authResponceObject after fiber is: " + JSON.stringify(authResponceObject,null,4)); return authResponceObject; }, 我想要做的是: […]

meteor:在打字中写meteor法时,找不到模块纤维/未来

我用angular2使用typecript es6和我遇到这个错误,同时为asynchronous函数写一个meteor方法。 我在插入查询中遇到了一个同步问题,因为当名称相同时,它在插入时不提供给我一个错误。 所以我决定使用光纤和未来,但打字稿不断给我一个错误,它无法find纤维/未来的模块。 我已经试过meteornpm安装光纤,meteornpm安装未来,meteor添加ostrio:neo4jdriver@1.0.2-纤维,但没有任何工作。 如果有任何解决scheme,请告诉我。 如果有其他方法可以用来解决这个问题,请告诉我。 import { Emails } from '../collections/emails.collection'; import { check } from 'meteor/check'; import { Meteor } from 'meteor/meteor'; import Future from 'fibers/future'; Meteor.methods({ loadEmailTemp: function(tempn: string){ let temp = Emails.findOne({tempname: tempn}); return temp; }, getAllTemplates: function() { let temps = Emails.find({}).fetch(); return temps; }, newTemplate: function(tempn: string) { […]

Shopify API如何生成发票,运输标签和运输清单?

您好,我正在尝试获取运输标签,发票和运输清单使用API​​ shopify订单 我能够使用以下命令获得订单: var request = require("request"); var options = { method: 'GET', url: 'https://<api key>:<password>@hostname/admin/orders.json', qs: { fulfillment_status: 'partial' }, headers: { 'postman-token': '2564af8e-df07-3bb8-3282-4956b70025b7', 'cache-control': 'no-cache' } }; request(options, function (error, response, body) { if (error) throw new Error(error); console.log(body); }); 但我无法find任何API的端点,航运标签,发票,运输清单

调用Javascript函数,但结果不完全返回

我是Meteor和Node.js的新手,因为我的问题可能仅仅是那些更熟练的人的平庸。 我正在编写一个脚本,将在未来30分钟内返回时间,格式如下: 11.12.16 20:05但是,如果我尝试运行我的函数,似乎没有任何事情发生,并且在控制台中没有错误或从服务器。 这是我的html: <body> <header>DPPZ</header> {{> price24}} {{> price32}} <div id="newWindow" style="display: none;"> <p id="time"></p> </div> </body> <template name="price24"> <div class="container24"> <button id="container24" onclick="ticket24()">24Kč</button> <p>(30 minut)</p> </div> </template> <template name="price32"> <div class="container32"> <button id="container32" onclick="ticket32()">32Kč</button> <p>(90 minut)</p> </div> </template> 这是我的JS: function ticket24(){ document.getElementById("newWindow").style.display = "block"; var d = new Date(); var den = […]

在Heroku上部署meteor应用程序时出错

我已经在heroku上部署了我的应用程序,在本地它工作得很好,但是当我打开我的应用程序,我得到这个消息“应用程序错误应用程序中发生错误,您的网页无法送达。如果您是应用程序所有者,logging详细信息“。 当我input“heroku日志”我得到这个 2016-12-30T15:44:46.897189+00:00 app[web.1]: npm ERR! Linux 3.13.0-105-generic 2016-12-30T15:44:46.897612+00:00 app[web.1]: npm ERR! argv "/app/.heroku/node/bin/node" "/app/.heroku/node/bin/npm" "start" 2016-12-30T15:44:46.897905+00:00 app[web.1]: npm ERR! node v6.9.1 2016-12-30T15:44:46.898079+00:00 app[web.1]: npm ERR! npm v3.10.8 2016-12-30T15:44:46.898366+00:00 app[web.1]: npm ERR! file sh 2016-12-30T15:44:46.898559+00:00 app[web.1]: npm ERR! code ELIFECYCLE 2016-12-30T15:44:46.898734+00:00 app[web.1]: npm ERR! errno ENOENT 2016-12-30T15:44:46.898904+00:00 app[web.1]: npm ERR! syscall spawn 2016-12-30T15:44:46.899048+00:00 app[web.1]: npm […]

用于构buildAPI的JavaScript文件

我想build立一个API。 我的应用程序是一个meteor/ nodejs应用程序。 所以我在api.js中创build了一个api.js文件: document.write({ example: 'Lorem ipsum' }); 我希望通过调用localhost:3000/api.js来获取对象作为输出,但是我却看到了源代码。 第二个问题: 我如何处理参数? 例如localhost:3000/api.js?type=article const type = get[type]; // should be 'article' in this example 使用路线将呈现HTML内容,但我需要输出纯JSON内容…

meteorSSR“错误:无法呈现未定义”

我想在基本的Meteor应用程序中使用IronRouter和Meteor-SSR进行服务器端渲染。 当我在浏览器中加载/home时出现以下错误: Error: Can't render undefined at checkRenderContent (packages/blaze.js:702:11) at contentAsView (packages/blaze.js:724:3) at Blaze.toHTML (packages/blaze.js:851:40) at Object.SSR.render (packages/meteorhacks_ssr.js:208:10) at [object Object].Router.route.where (main.js:9:20) at boundNext (packages/iron_middleware-stack.js:408:31) at runWithEnvironment (packages/meteor.js:1176:24) at packages/meteor.js:1189:14 at [object Object].urlencodedParser (/Users/roger/.meteor/packages/iron_router/.1.1.1.1q7cd8x++os+web.browser+web.cordova/npm/node_modules1/body-parser/lib/types/urlencoded.js:84:40) at packages/iron_router.js:886:36 这里是应用程序的代码: // main.js if (Meteor.isServer) { Router.route('/home', function() { let html = SSR.render('home'); this.response.end(html); }, {where: 'server'}); } if […]

meteorNodeJs base64转换回文件

所以在前面我有这段代码。 uploadCallback (file) { // TODO: Integrate dropbox with its SDK // TODO: Pass the link to the editor console.log('file', file) this.getBase64(file, this) } getBase64 (file, self) { const reader = new FileReader() reader.readAsDataURL(file) reader.onload = function () { console.log('reader.result', reader.result) self.sendFileToServer(reader.result) } reader.onerror = function (error) { console.log('Error: ', error) } } sendFileToServer (base64File) […]

如何在发布时返回一个空的结果光标?

我如何返回一个空的光标? Meteor.publish('example', function(id) { check(id, Match.Maybe(String)) if (!this.userId) return [] }) 在这个例子中,如果用户没有login,那么发布应该会给我一个空的结果。但是像上面显示的那样,给了我这个错误 Error: Publish function can only return a Cursor or an array of Cursors

从angular度$ locationProvider中的URL中删除#后的问题

在我的app.js我有 $routeProvider .when('/', { templateUrl: '/views/main.html' }) .when('/admin', { templateUrl: 'views/admin.html', controller: 'admin', }) 所以我的路线是本地主机:3000 /#/和点击button,它把我到本地​​主机:3000 /#/pipe理我想从我的url删除#所以我用 $locationProvider.html5Mode({ enabled: true, requireBase: false }); 现在localhost:3000/正在工作,点击button,它把我带到localhost:3000/admin 。 但是,如果我直接给localhost:3000/admin在url中,它是给不能得到localhost:3000/#/admin 。但是,如果给localhost:3000/#/admin ,这是带我到localhost:3000/admin为什么这种行为,我怎么能使localhost:3000/admin可以帮助某人