sails.js

Why doesn't .add() insert value in the column?

只愿长相守 提交于 2019-12-02 08:46:41
I'm trying sails.js association using one way reference (according to sails.js in action book). Now, the value of owner is successfully inserted in owner column, but value in cars column is not inserted. When I tried console.log(foundDriver) and console.dir(foundDriver) , it showed following things: { id: 1, Name: 'asdf' } { cars: [Getter/Setter], id: 1, Name: 'asdf' } My tables (1: driver , 2: car ): CODE: Car.js module.exports = { connection: 'mysqlAdapter', tableName: 'car', attributes: { id: { type: 'integer', primaryKey: true }, Name: { type: 'string' }, Brand: { type: 'string' }, Model:

Sails socket io connecting to a different url than the one passed in

梦想与她 提交于 2019-12-02 08:03:38
问题 In production when I try to connect to my socket client in sails at 'https://something.com/api/' from the client url 'https://something.com/' I get a 404 https://something.com/socket.io/?__sails_io_sdk_version=0.13…owser&__sails_io_sdk_language=javascript&EIO=3&transport=polling&t=LFGJG5g 404 (Not Found) When I establish a socket connection in sails on my local machine it works. My Local Configuration. CLIENT HOST http://localhost:8080/ API HOST http://localhost:1337/ HTML <script src="sails

Sails Js permissions

随声附和 提交于 2019-12-02 07:36:42
I got a sailsjs app on a debian server. My only user is root, I installed everything in root (npm install, npm install sails -g, npm install pm2 -g). When I try to deploy it with my root user (sails lift --prod), I got permissions errors : Grunt :: Running "clean:dev" (clean) task Grunt :: Cleaning .tmp/public... Grunt :: Warning: Cannot delete files outside the current working directory. ** Grunt :: An error occurred. ** error: ------------------------------------------------------------------------ Aborted due to warnings. Running "clean:dev" (clean) task Cleaning .tmp/public...Warning:

How to get current socket object or id with in a sails controller?

我只是一个虾纸丫 提交于 2019-12-02 07:29:14
I would like to access the currently connected socket id with in a sails.js (v0.12 ) controller function. sails.sockets.getId(req.socket); is showing undefined since this is not a socket request My objective is to set the online status of my user in the database when he logged in successfully login: function (req, res) { Util.login(req, function(){ var socketId = sails.sockets.getId(req.socket); console.log('socketId ===', socketId); // return undefined }); }, Basically i would like to access the current user's socket object in a controller or access current user's session object with in a

Nested Models and controllers in sails are not working Policies

匆匆过客 提交于 2019-12-02 07:24:13
问题 Continuation of this bug : API Versioning in SailsJS Sails Permissions AuditPolicy is not working properly. can any one guide me to do. O/P: error: Sending 500 ("Server Error") response: Error: Invalid route option, "model". I don't know about any models named: `v1/user` at Object.module.exports.parseModel (E:\demo- server\node_modules\sails\lib\hooks\blueprints\actionUtil.js:266:25) at ModelPolicy (E:\demo-server\node_modules\sails-permissions\api\policies\ModelPolicy.js:8:42) at

Confusion about web-application ports

天涯浪子 提交于 2019-12-02 06:04:16
I have a project that is already deep in development, and there is a problem with the ports. The Client is SPA written in backbone, that uses Sails as a server. Problem is in the fact that Client is running in Express on port 80, while Sails is run on 1337. I would like to host this backbone application within the Sails, not ouside the sails. A bit more details: When I fire the Fiddler, I am seeing requests being made to localhost:1337/get/user. I need it to reside on port 80 as well. Backbone is written using standard. I have app.js and main.js with all of the common folders (JS, LIBS, CSS).

sailsjs still uses default database after changing it to mongodb

微笑、不失礼 提交于 2019-12-02 05:10:17
问题 I am new to sailsjs and currently working on project that uses sailsjs. I want to change the default database to mongodb . I did it in config/local.js like following connections: { 'defaults': 'mongo', mongo: { module: 'sails-mongo', host: 'localhost', user: '', password: '', database: 'dbName', schema: true } } After starting mongodb and tried to create some data using application(that I am working on), and then when I check that in mongodb using mongodb command line tool . It finds no data

Sailsjs Mysql ORM multiple query on the same table field

岁酱吖の 提交于 2019-12-02 04:57:38
Im using sails v 0.10.5 and latest sails-mysql I have a Restaurant filtering system Venue.find().populate('comments', { deleted: false }).where({ restaurant_services: {contains: '"delivery":1'}, restaurant_services: {contains: '"takeout":1'}, restaurant_specialties: {contains: '"breakfast":1'} }) Now the problem is when I get the data from the client, I do not know how many items the user has selected for restaurat_services, so obviously I have to create a dynamic JSON object for the .where() function The problem is though, I cannot do this var searchObj = {}; searchObj['restaurant_specialties

Sails socket io connecting to a different url than the one passed in

自古美人都是妖i 提交于 2019-12-02 04:08:28
In production when I try to connect to my socket client in sails at ' https://something.com/api/ ' from the client url ' https://something.com/ ' I get a 404 https://something.com/socket.io/?__sails_io_sdk_version=0.13…owser&__sails_io_sdk_language=javascript&EIO=3&transport=polling&t=LFGJG5g 404 (Not Found) When I establish a socket connection in sails on my local machine it works. My Local Configuration. CLIENT HOST http://localhost:8080/ API HOST http://localhost:1337/ HTML <script src="sails.io.js" autoConnect="false"></script> JS connect() { this.socket = io.sails.connect('http:/

Deploying Sails.js On Openshift

假装没事ソ 提交于 2019-12-02 03:30:36
问题 When I deploy a Sails.js app to OpenShift it restarts over and over again. So basically I am having the exact same problem with the same output from rhc tail described in this question and this answer describes why this error is occurring but there are no solutions offered Has anyone successfully deployed a Sails.js app to OpenShift ? I am committed to the OpenShift platform at this point but really want to use SailsJS for my next app. Thanks for any suggestions. 回答1: In order to start Sails