sails.js

SailsSocket Keep Trying to Reconnect

孤街浪徒 提交于 2019-12-24 06:32:19
问题 After struggling with socket.io connection authentication (here and here) and thanks to @sgress454, I realized how to get this to work and I am sending the authentication/authorization token as part of the query in the connection (see below). Upon authentication failure (invalid/expired token or in-active user), I return the callback with false parameter to indicate the connection is rejected. On the client side though, I am not sure how I should handled it and it seems the socket is trying

How do I serve static files using Sails.js only in development environment?

最后都变了- 提交于 2019-12-24 05:48:08
问题 On production servers, we use nginx to serve static files for our Sails.js application, however in development environment we want Sails to serve static files for us. This will allow us to skip nginx installation and configuration on dev's machines. How do I do this? 回答1: I'm going to show you how you could solve this using serve-static module for Node.js/Express. 1). First of all install the module for development environment: npm i -D serve-static . 2). Create serve-static directory inside

sails v0.10.0-rc7 unique constraint not working

别等时光非礼了梦想. 提交于 2019-12-24 04:20:27
问题 I upgraded my sails from rc4 to rc7 today, and the unique constraint on my model stopped working. note that in rc4 it used to work perfectly. and sails-mongo version on both versions i tried is: "sails-mongo": "^0.10.0-rc5" Model attribute: emailAddress: { type: 'email', required: true, unique: true }, any issues? 回答1: As already stated it's a bug in waterline/sails-mongo I however advise against setting syncable to true as it was set to false by the developers for a reason (the github bug

sails js data relationship

跟風遠走 提交于 2019-12-24 04:17:49
问题 Does sails.js support relationships between models/collections? If so, can someone point to documentation? For example: I have 2 models 1.Production production: { name: 'string', description: 'text' } 2.Album album: { name: 'string', productionID: 'ObjectID'// How do I get to "production"? } 回答1: Sailsjs 0.9.x does not support relationships or associations currently. 0.10 does have a rough outline of this working. Disclaimer: the 0.10 branch is a constant work in progress and can break on a

sails js data relationship

邮差的信 提交于 2019-12-24 04:17:03
问题 Does sails.js support relationships between models/collections? If so, can someone point to documentation? For example: I have 2 models 1.Production production: { name: 'string', description: 'text' } 2.Album album: { name: 'string', productionID: 'ObjectID'// How do I get to "production"? } 回答1: Sailsjs 0.9.x does not support relationships or associations currently. 0.10 does have a rough outline of this working. Disclaimer: the 0.10 branch is a constant work in progress and can break on a

Dynamically set LESS variables from user settings

醉酒当歌 提交于 2019-12-24 04:13:06
问题 This is a simple matter to explain really. It's either possible or it's not. I have user settings in the DB, or will have at least. These settings will contain things like font sizes, colors and opacity. I need to get them from the member object and into the LESS styles. Before I go on I should let you know that I'm using Node.js + Sails.js + MongoDB. My member object will look similar to ( truncated data ): { _id: ObjectId("52afc219c41e159808d41be5"), createdAt: ISODate("2013-12-17T03:16:41

Dynamically set LESS variables from user settings

喜夏-厌秋 提交于 2019-12-24 04:13:00
问题 This is a simple matter to explain really. It's either possible or it's not. I have user settings in the DB, or will have at least. These settings will contain things like font sizes, colors and opacity. I need to get them from the member object and into the LESS styles. Before I go on I should let you know that I'm using Node.js + Sails.js + MongoDB. My member object will look similar to ( truncated data ): { _id: ObjectId("52afc219c41e159808d41be5"), createdAt: ISODate("2013-12-17T03:16:41

SailsJS: Requiring Assets, Such As, sails.io.js

混江龙づ霸主 提交于 2019-12-24 03:52:45
问题 As the problem is short & sweet, I'll keep the question so. CAN'T LOAD ASSETS. Using Sails.js ( v0.11.n ). Can't load assets... That's about it... I'm trying to load sails.io.js -- or now even just assets/alert.js . <script type="text/javascript" src="/js/dependencies/sails.io.js"></script> Doesn't work :( Even when I switch the src to /alert.js -- nothing. I'm pasting this script tag inside of my /signup view -- which loads fine -- but I know sure as heck I'm doing something(s) wrong. 回答1:

SailsJS: Requiring Assets, Such As, sails.io.js

試著忘記壹切 提交于 2019-12-24 03:52:04
问题 As the problem is short & sweet, I'll keep the question so. CAN'T LOAD ASSETS. Using Sails.js ( v0.11.n ). Can't load assets... That's about it... I'm trying to load sails.io.js -- or now even just assets/alert.js . <script type="text/javascript" src="/js/dependencies/sails.io.js"></script> Doesn't work :( Even when I switch the src to /alert.js -- nothing. I'm pasting this script tag inside of my /signup view -- which loads fine -- but I know sure as heck I'm doing something(s) wrong. 回答1:

Populating a Many to Many Through Relation in Sails.js

烂漫一生 提交于 2019-12-24 03:46:13
问题 Sails.js offers a way to populate objects in Many to Many relationship via its Blueprint API. Thus, GET /categorymodel/:categoryid/productscollection will return all products that belong to the specified category. Link. For Many to Many Through relations, the docs advises to use multiple One to Many relations via an intermediary model to achieve the desired organization. The downside of this is there's no way to populate objects via the built-in Blueprint API. Link. So, while querying for