Tag: sails.js

(节点)错误:模块没有自行注册

解除发球时出现此错误:帆升降机 Error: Module did not self-register. at Error (native) at Object.Module._extensions..node (module.js:440:18) at Module.load (module.js:357:32) at Function.Module._load (module.js:314:12) at Module.require (module.js:367:17) at require (internal/module.js:16:19) at Module._compile (module.js:413:34) at Object.Module._extensions..js (module.js:422:10) at Module.load (module.js:357:32) at Function.Module._load (module.js:314:12) at Module.require (module.js:367:17) at require (internal/module.js:16:19)

sails.js项目中routes.js的延迟效果

我试图确定如果routes.js如果使用,可能会导致错误的响应时间,或使用不当。 由于我们的负载testing中的响应时间很差。 我们使用routes.js来加载视图并将请求路由到一个控制器方法(对于db查询)。 加载视图示例: 'GET /' : {view: 'mainframe'} 路线请求示例: 'GET /main_edit' : {controller:'MainController', action:'edit', skipAssets: true} 我们有大约30个不同的“路线”。 我碰到一个netflix的post,似乎表明这个路由可能会给出一个问题,因为它用于保持路由的数组。 他们使用路线的方式似乎与上述不同。 使用:node.js v5.6.0和sails.js 0.12.0

数据字典存储和检索与MongoDB和Node.js应用程序

我的项目中有以下要求。 这是一个报告应用程序,因此主要是存储关于我的实体的数据,大多数时间将检索它并在网页上显示为不同的报告。 我正在使用node.js和mongodb这个项目。 数据是以excel的forms出现的。 有超过2000列,每列有一个短码,如s0a_1,s0a_2,s1a_1,s1a_2等。每个列代码映射到一个长意义的文本。 例如,s01_1 – >这个人的名字是什么? ,s01_2 – >'项目名称'等等。对于每一列都会有一个相应的值,这个值是大部分时候的数字。 在我的报告中,我需要展示长意义的文本和相应的价值。 那么,实现这个目标的最好方法是什么? 我们可以想到以下方面: 在mongo中创build一个集合,并将短代码/文本存储为键值对,并且每次在将响应发送给客户端之前,用短文本代替短代码。 作为键值对存储在属性文件中 为了这个特定的目的使用redis 任何帮助将不胜感激。 谢谢。

我的angular度视图不显示我的数据

<div ng-show ="formMode == 'HotelSearch'" id="hotelResults" ng-controller="hotelSearchCtrl"> <div class="row" ng-repeat="hotel in hotels"> <div class="col-md-6 col-lg-4 col-sm-12"> <div class="card"> <div class="front"> <div class="cover"> <img src="images/city.jpg" class="img-responsive"/> </div> <div class="content"> <div class="main"> <h3 class="name">{{hotel.name}}</h3> <h5><i class="fa fa-map-marker fa-fw text-muted"></i> {{hotel.location}}</h5> <h5><i class="fa fa-building-o fa-fw text-muted"></i> {{hotel.phone}}</h5> <h5><i class="fa fa-envelope-o fa-fw text-muted"></i> {{hotel.email}}</h5> </div> <div class="footer"> </div> </div> […]

SailsJS无法重新加载ORM钩子

安装了sails-auth和sails-permissions软件包之后,我的autoreload hook( https://github.com/sgress454/sails-hook-autoreload )不再工作了: 错误:无法重新加载ORM钩子。 详细信息:错误:无法重新初始化ORM,因为ORM钩子的initialize()方法返回错误。 详细信息:错误:一致性违规:实例化的水线模型已具有数据存储属性。 包: "bcryptjs": "^2.3.0", "ejs": "2.3.4", "grunt": "0.4.5", "grunt-contrib-clean": "0.6.0", "grunt-contrib-coffee": "0.13.0", "grunt-contrib-concat": "0.5.1", "grunt-contrib-copy": "0.5.0", "grunt-contrib-cssmin": "0.9.0", "grunt-contrib-jst": "0.6.0", "grunt-contrib-less": "1.1.0", "grunt-contrib-sass": "^1.0.0", "grunt-contrib-uglify": "0.7.0", "grunt-contrib-watch": "0.5.3", "grunt-sails-linker": "~0.10.1", "grunt-sync": "0.2.4", "include-all": "~0.1.6", "marlinspike": "^1.0.0", "passport": "^0.3.2", "passport-local": "^1.0.0", "rc": "1.0.1", "sails": "~0.12.3", "sails-auth": "^2.1.3", "sails-disk": "~0.10.9", "sails-hook-autoreload": […]

如何将jquery引导file upload插件中的自定义标头传递到节点服务器

我想传递一个标记字段和它的值以及file upload操作。 我正在使用Bootstrap文件input插件,但它不像其他默认头一样将自定义标头发送到nodejs服务器。 我已经尝试了下面的代码。 请帮我解决这个问题。 此代码与我的本地Apache服务器与基于PHP的代码正常工作,这个问题只显示在我的nodejs服务器,我使用的是sailsjs。 <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="description" content=""> <meta name="author" content=""> <link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-fileinput/4.3.1/css/fileinput.css" rel="stylesheet" type="text/css"><br> <link href="https://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" rel="stylesheet"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-fileinput/4.3.1/js/fileinput.min.js"></script> <script src="https://netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script> </head> <body> <input id="file-1" class="file" type="file" multiple data-preview-file-type="any"> <script> $("#file-1").fileinput({ uploadUrl: '#', // you must set […]

用于sailsjs的mongodb mapReduce

我正在尝试根据创build时间对两个集合进行sorting。 我通过stackoverflowsearch,并find了解决scheme,这是提到这个链接http://tebros.com/2011/07/using-mongodb-mapreduce-to-join-2-collections/这是你mapReduce集合另一个名为join集合然后使用给定的参数进行sorting(在我的情况下是创build时间)。 现在的问题是我们如何在Sailsjs中进行mapReduce,我已经提到这个http://sailsjs.org/documentation/reference/waterline-orm/models/native我们有这个代码。 Pet.native(function(err, collection) { if (err) return res.serverError(err); collection.find({}, { name: true }).toArray(function (err, results) { if (err) return res.serverError(err); return res.ok(results); }); }); callback中的collection参数携带find,create等属性。 采集参数是否有mapReduce函数? 因为它在我的情况是不确定的。 除了打开原始连接并使用在config / connection.js(默认连接)中打开的连接之外,是否有任何方法可以在Sailsjs中使用mapReduce。 或者更好的方法来基于特定的属性来sortingMongoDB中的2个集合? Sails v0.11.5,节点v0.4.4.2 谢谢。

sails-postgresql错误:密码authentication失败的用户“postgres”

我正在构build一个Sails.js应用程序,并且使用我的所有连接信息设置了sails-postgresql适配器,并且在我第一次解除应用程序并创build了所有表时,它工作正常。 现在我得到这个错误: error: A hook (`orm`) failed to load! error: error: password authentication failed for user "postgres" at Connection.parseE (/root/royaltyPayer/vigilant-disco/royaltyPayer/node_modules/sails-postgresql/node_modules/pg/lib/connection.js:540:11) at Connection.parseMessage (/root/royaltyPayer/vigilant-disco/royaltyPayer/node_modules/sails-postgresql/node_modules/pg/lib/connection.js:367:17) at Socket.<anonymous> (/root/royaltyPayer/vigilant-disco/royaltyPayer/node_modules/sails-postgresql/node_modules/pg/lib/connection.js:105:22) at emitOne (events.js:96:13) at Socket.emit (events.js:188:7) at readableAddChunk (_stream_readable.js:172:18) at Socket.Readable.push (_stream_readable.js:130:10) at TCP.onread (net.js:535:20) 我已经尝试了所有发布到这个问题的答案: Postgresql:密码authentication失败的用户“postgres” 我已经确保我的linux密码和用户postgres的数据库密码是相同的。 这是来自/etc/postgresql/9.4/main/pg_hba.conf的相关行: local all postgres peer 这是我在config / connections.js中的代码: module.exports.connections = { […]

连接套接字从testing中航行

我试图从摩卡testing风帆套接字连接。 var socketIOClient = require('socket.io-client'); var sailsIOClient = require('sails.io.js'); // Instantiate the socket client (`io`) // (for now, you must explicitly pass in the socket.io client when using this library from Node.js) var io = sailsIOClient(socketIOClient); // Set some options: // (you have to specify the host and port of the Sails backend when using […]

Sails.js如何在async.series()中使用for循环?

我想在我的服务中使用async.series([]),然后将结果返回给Controller。 但是,似乎async.series的可选callback函数并没有等到任务完成才返回到控制器。 /* In Services */ getFunction: function(userInput, callback) { var results = {}; async.series([ //1: This function get a list JSON dataset of id and other attributes function(callback) { //Call a function to call API by using the userInput, return function(error, JSONdataset1) //If error, return callback(error) //Else results = JSON.parse(dataset1); callback(null, JSON.stringify(results)); }, //2: […]