Tag: 强回圈

将Node.js群集应用程序迁移到StrongLoop ProcessManager

我在多个实例上运行Node.js express web应用程序和api使用节点cluster 我的集群启动文件是典型的 'use strict'; (function() { /// node clustering const cluster = require('cluster'); const numCPUs = require('os').cpus().length; var clusterConfig=require('./config/clusterconfig.json'); if (cluster.isMaster) { // master node // process=master console.log(`Master ${process.pid} is running`); // Fork workers. var maxCPUs = clusterConfig.master.workers; maxCPUs=(maxCPUs>=numCPUs)?numCPUs:maxCPUs; for (let i = 0; i < maxCPUs; i++) { const worker=cluster.fork(); } var […]

Strongloop自定义脚本不会退出

我可能监督一些非常基本的东西,但我有这个基本的strongloop自定义脚本,这是假设做一些数据清理。 脚本运行正常,这不是问题,是否所有这一切都假设(打印所有console.log),但过程永远不会退出。 有什么我必须做结束strongloop? var app = require('../server/server'); app.models.product.find({}, (err, result) => { console.log('result', result); //Do data cleanup console.log('done now'); });

用(或)和(和)同时查询数据

我需要这样做。 select * from person where (firstname like '%a' or lastname like "%a") and id NOT IN (1 , 2) Node.js的: BegroupdUser.find({ limit: limit, skip: skip, where: { id: { nin: adminIds }, or: [{ firstName: {like: '%' + _query + '%'} }, { lastName: {like: '%' + _query + '%'} }] } }, function […]

强-pm http auth 401

我已经在AWS Linux实例上安装了strong-pm: [root@box]# npm -g install strongloop strong-pm [root@box]# sl-pm-install –http-auth user:pass –force –upstart 0.6 –set-env NODE_ENV=production [root@box]# /sbin/initctl reload-configuration [root@box]# /sbin/initctl restart strong-pm strong-pm start/running, process 18171 当我试图检查强下午的状态时,我得到了401 [root@box]# slc ctl -C http://user:pass@localhost:8701 (node:18234) fs: re-evaluating native module sources is not supported. If you are using the graceful-fs module, please update it to a […]

如何在Strongloop前端编写GET查询

我想使用strongloop API检查数据。 我有一切设置和工作,但我不想编写C#只是为了检查数据模型的更新,现在。 我想使用提供的前端。 即使用GETfunction。 比方说,我有一个表A与列:A1,A2和A3。 我如何得到A中的一行的值,例如A1 = 5? 什么是语法和语义? 我想知道如何使用它,而不是只记得它。

隐藏相关模型的方法

如何隐藏相关模型的方法? 比方说,在demo app loopback-example-datagraph中 ,我不想公开DELETE /customers/{id}/orders方法。 我应该怎么做呢?

用我的节点应用程序设置StrongLoop

我目前正在testing为nodejs应用程序提供监视服务的平台。 所以我发现(现在)StrongLoop和AppDynamics(最近获取节点时间)。 其实我正在testingStrongLoop服务。 我已经按照文档中描述的所有步骤操作,但是在仪表板上看不到任何数据,只有StrongLoop Demo App。 以下是所有步骤: npm install -g strongloop npm安装 – 保存强大的代理 $ slc strongops(创buildstrongloop.json文件的命令) 添加“require('strong-agent')。profile();” 在每个应用程序的第一行(2) 重新启动我的应用程序(使用PM2pipe理我的应用程序 – 群集模式,AWS EC2,Ubuntu) 任何想法 ? 保护你。

如何使用StrongLoop在Node.js中提供dynamic内容?

我对Node.js很新,但是StrongLoop Docs并没有给出具体的例子。 我为我的模板使用Handlebars,而只是试图提供一个标准的index.js预编译模板。 我知道我应该编辑我的routes.js文件,但我不知道该怎么做。 这是我的routes.js文件看起来像: module.exports = function(app) { // I need this to serve my index.js file. app.get('/', function(req, res) { // Doesn't work, so I commented it out: // require('views/index.js'); // Doesn't work, so I commented it out: // res.requires('views/index.js'); // Doesn't work, so I commented it out: // res.send('views/index.js'); // What do […]

如何使用强循环对数据进行计数(在包含“模型”中过滤的排除logging)

我正尝试用XYZ连接表ABC ,并使用Strongloop在ABC中计数logging(排除在XYZ中过滤的logging)。 我的代码是: ABC.count({where: {abcPropertyName: {neq: '0x0'}}, include: { relation: 'XYZ', scope: {where: {xyzPropertyName: 'someValue'}}}}).$promise.then(function (result) { $rootScope.CountRes= result.count; }); 问题:在'xyz'中的filter不工作。它在ABC中统计所有logging。

如何获得强回圈集群中的工作者/进程ID列表?

看起来Strongloop集群中的每个进程都被视为一个工作者,因此如果使用节点调度程序等工具来调度作业,并且有多个工作人员,则会多次执行作业。 理想情况下,我可以做一些事情: var cluster = require('cluster'); if (cluster.isMaster) { // execute code } 由于这似乎不可能,我想知道是否有办法从节点应用程序内部获取所有工作进程或进程ID的列表,以便我可以对一个工作人员执行同样的操作? 这将需要dynamic的,因为工作人员ID是不可预知的,因为cluster.worker.id似乎不是一个可靠的方法来做到这一点。 想法?