sails.js

How to use dynamic page titles in sails.js >v1.0?

我与影子孤独终老i 提交于 2019-12-11 17:55:07
问题 For the last few days I was looking for a viable solution in order to optimize html page titles <title>SOME_TITLE</title> within sails.js layout files, like layout.ejs , that by default use a static page title. Obviously, it would be way better to have dynamic page titles, e.g. Dashboard, Shopping Cart, etc... Other people were looking for this answer before and got answers for prior sails versions in Solution 1, Solution 2 and Solution 3. Unfortunately, none of them seem to be appropriate

sails-mongo auth error in sails 0.10

南笙酒味 提交于 2019-12-11 14:35:45
问题 Using "sails-mongo": "^0.10.0-rc2", "sails": "~0.10.0-rc4" I'm getting the following error on sails lift . verbose: Loading adapter ( sails-mongo ) for algorithm from `node_modules` directory... Failed to load c++ bson extension, using pure JS version verbose: Starting ORM... error: A hook (`orm`) failed to load! error: MongoError: auth fails at Object.toError (/home/default/Projects/machine_learning_data_sets/machine-learning- engine/node_modules/sails-mongo/node_modules/mongodb/lib/mongodb

SailsJS: Get Resonse of Ajax-Form of SailsJS in the submitted function

北城余情 提交于 2019-12-11 14:04:03
问题 I want to get an object from an action, which is called by an ajax form component. Steps to reproduce. create a ajax form where you passing values for a model (eg. title and description for a post) After handling the submitting form let pass the data to a action In the action you will safe the given data to the MongoDB and fetch that created data with .fetch() You pass the fetched data to exits.success(fetchedData) Try to get the data in the submittedForm function in the xxxx.page.js I am not

Connect session in PostgreSQL with SailsJS

若如初见. 提交于 2019-12-11 14:03:32
问题 I have a personal project in SailsJS, Passport-Local and PostgreSQL. I managed to get connection and save users in PostgreSQL DB. But I have big problem with session storing. From what I know SailsJS is using Connect to get it done. Previous working code for MongoDB: connections: { prodMongodbServer: { adapter: 'sails-mongo', host: 'localhost', port: 27017, //user: '', //password: '', database: 'sails-auth' } }, session: { adapter: 'mongo', host: 'localhost', port: 27017, db: 'sails-auth',

SailsJs Invalid module error

浪子不回头ぞ 提交于 2019-12-11 13:47:33
问题 After I installed lodash or async plug-ins, Console shows those error messages when I launch sails.js . but I don't know what cause those error messages. I need to solve this problem. please anyone help me. error: A hook (`userconfig`) failed to load! error: Error: Invalid module:[object Object] at /Users/johndo/github/sails/testProject/node_modules/sails/node_modules/sails-build-dictionary/index.js:83:15 at forOwn (/Users/johndo/github/sails/testProject/node_modules/lodash/dist/lodash.js

How do I give my worker.js access to the `sails` object

江枫思渺然 提交于 2019-12-11 12:54:53
问题 Following Heroku's encouragement to a worker dynos I created a worker.js file in my Sails project. However, this file is executed independently with a node worker.js but i'd like to reuse the config I set up for my sails app. Specifically the sails.log and sails' models. How do I give my independently executed worker.js file access to the sails object. 回答1: After tons of tweeting and asking around, I finally managed this with sails.load() . Based on the answer here: var Sails = require('sails

Sails js - waterline orm - mysql. Tables autogeneration

夙愿已清 提交于 2019-12-11 12:33:13
问题 When I create my model in sails - waterline the db is autogenerated. The problem is that my primary keys are unsigned int(10) and the external keys are int(11) (with sign). In fact the relationship is only in my models and not in db. A code example is the following: // A user may only have a single pet var User = Waterline.Collection.extend({ identity: 'user', connection: 'local-postgresql', attributes: { firstName: 'string', lastName: 'string', // Add a reference to Pet pet: { model: 'pet' }

Why mongodb is reset after push to openshift

你。 提交于 2019-12-11 12:07:50
问题 I am deploying my application written using sails.js onto the openshift. It works properly but however when i commit something new. It will then build again and clean up all my data in the mongodb. So I wonder any reasons? Sorry i am new to openshift Is it normal mongodb will be cleaned up after stop/start MongoDB cartridge? How to keep the data remained in the mongodb? do i need to perform save when stop and restore when start? I am curious how it automatically build and restart the

Sails not generating linker

▼魔方 西西 提交于 2019-12-11 11:37:11
问题 I am trying to use associations with Sails.js 0.10, I generated my app with: sails new name --template jade --linker Application is running fine, but I don't see any assets/linker folder as I did in version 0.9., are all files minified by default in 0.10? 回答1: In 0.10 you don't need the "linker" folder, it will just compile and link everything in assets/js, assets/styles and assets/templates. You can check the grunt files (in "tasks" root folder) to figure what's actually done there :). 来源:

Inject javascript to specific view/route in Sailsjs after all the global javascripts

二次信任 提交于 2019-12-11 11:35:07
问题 Recently I have been trying to build a really simple chat app using sailsjs, the app has only 3 pages, each page has different sets of reference data that will feed twitter typeahead js, what I intend to do is like this: var socket = io.connect('http://localhost:1337'); $(document).ready(function () { var $modalLayer = $(JST['assets/templates/generic/modal.html']({})); $modalLayer.appendTo("body").modal('show'); socket.on('connect', function () { socket.request('/chat/references', {},