sails.js

BabelJs over Heroku: Couldn't find preset “env” relative to directory “/app”

两盒软妹~` 提交于 2019-12-11 04:27:09
问题 I have an application with SailsJs over NodeJs on Heroku and I can't run babeljs on. It runs ok on my localhost, but I always get the error: Error: Couldn't find preset "env" relative to directory "/app" The Heroku persists in look for itens at /app folder. This project does not have one /app folder My app folders structure is: app_name - api - assets - config - tasks - views I follow the documentation of http://babeljs.io to my .babelrc .babelrc now: { "presets": ["react", "env", "stage-1"],

Why wouldn't a waterline callback happen to be triggered?

一曲冷凌霜 提交于 2019-12-11 04:25:02
问题 I'm using Sails built in models and it's ORM to perform MongoDB queries and operations. The problem I got is that, for some query methods,it's callback is never being called. The DB operation gets done, but callback won't come up. Following code snippet is model querying part of a controller method for an API, that's why I'm using a response object. LineUp.update({ id: request.param('id') }, { players: [], budgetLeft: 60000000 }). exec(function (err, lineup) { console.log("Should happen");

Sailsjs view caching (bug ?)

一世执手 提交于 2019-12-11 04:17:42
问题 I was rendering a view using res.view('layout', {my: 'Object'}) . Peculiar Behaviour: When I changed the ejs file and refreshed the browser, the change was visible (without server restart). BUT If my object contained a truthy value of property cache , like so: res.view('layout', {my: 'Object', cache: true}) then, I open the view in the browser, all's good. But if I change the ejs file now, the changes do not show in the browser on refresh, unless server is stopped and re-lifted. Is there any

Sails.js + Passport.js: passport.initialize() middleware not in use

痴心易碎 提交于 2019-12-11 04:07:08
问题 I am using Sails.js and trying to use Passport.js with a REST API. But I am facing the following error when I try to call my login function in my controller: /Users/Michael/Development/DictationProject/sails/20151010/dictee/node_modules/passport/lib/http/request.js:44 if (!this._passport) { throw new Error('passport.initialize() middleware not in use'); } ^ Error: passport.initialize() middleware not in use at IncomingMessage.req.login.req.logIn (/Users/Michael/Development/DictationProject

BreezeJS on Durandal with PHP REST API (Laravel)

人盡茶涼 提交于 2019-12-11 04:05:27
问题 I'm writing a SPA in Durandal 2.1. So far so good. However, I'm having great difficulties in selecting the right Data Persistence library to communicate with my PHP (Laravel) REST API. The number one library for Durandal is BreezeJS. It is said that it supports API's without oData / ASP.NET Entity framework. I've searched for many days now, but I can't find any decent resource telling me how to use BreezeJS with my basic PHP REST API. The wish-list is as follows: Persist data between views

Handling errors at a global level

筅森魡賤 提交于 2019-12-11 03:48:09
问题 I am trying to understand how to build my error handling system for my api. Let's say I have a the following line in a controller method : var age = json.info.age; with json = {"id":1, "name":"John", info": {"age":27, "sex":"m"}} Let's say that the object doesn't contain an info field, I'll get the following error TypeError: Cannot read property 'info' of undefined and my server will crash. Is there a way to make a higher level abstraction and catch all the potential errors that I could have?

Sails.js to client using sails.sockets.join and sails.sockets.broadcast doesn't return info to the client

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-11 03:22:45
问题 I'm attempting to create a one to one chat using Sails.js and sails.io.js on the client side. I can get the io.socket.get and io.socket.post to work, but I haven't been able to receive anything from either sails.sockets.broadcast or Model.publish as instructed here: Personalized chat using Sails.js or here Sails.js + socket.io: Sending messages from server to clients Server Side Code: UserController.js module.exports = { listen: function(req, res) { console.log("about to join " + userId);

sailsjs array query Exact match

跟風遠走 提交于 2019-12-11 03:16:46
问题 i want to query mongodb in sailsjs. this is structure of my db { "users": [ "52ed09e1d015533c124015d5", "52ed4bc75ece1fb013fed7f5" ], "user_msgs": [ { "sender": "52ed09e1d015533c124015d5", "sendTo": "52ed4bc75ece1fb013fed7f5", "msg": "ss" } ], "createdAt": ISODate("2014-02-06T16:12:17.751Z"), "updatedAt": ISODate("2014-02-06T16:12:17.751Z"), "_id": ObjectID("52f3b461f46da23c111582f6") } I want to search those "users" who who match array [ "52ed09e1d015533c124015d5", "52ed4bc75ece1fb013fed7f5"

Sails js - Creates a copy of assets

末鹿安然 提交于 2019-12-11 03:08:18
问题 We are considering porting our project to Sails.js. Our static assets are quite large - more than 3 GB. So, this has created a serious limitation as it doubles the size of our app. Can we modify Sails js to prevent this default behavior or can some one recommend some other framework? 回答1: Sails uses Grunt to copy your assets into (by default) a clean .tmp/public folder every time the app is lifted. This allows you to pick and choose which assets should be made public, and also lets you

Sail.js multiple connections on start

六眼飞鱼酱① 提交于 2019-12-11 03:04:00
问题 I've got an odd problem - on start of my sails app (which is connecting with postgres and deployed on heroku ) there are multiple connections (around 10) to database, and since it's free account, if I then try to launch app on localhost to test some new code I get an error "too many connections for a role". So does anyone know why there are so many connections to database and can I change it, to have only one connection per app? EDIT: Error creating a connection to Postgresql: error: too many