sails.js

How to import and use a regular vuejs component in sailsjs?

佐手、 提交于 2019-12-22 10:53:36
问题 I need to use a vue component packages as npm module with sails. Tried everything: can't import it into the page instance, import not allowed there; can't import it into a parasails.registerCompnent, same error; require also not working; importing it in the main app.js doesn't serve. Looked everywhere, it is terribly frustrating, no information anywhere. It is one of the moments I regret choosing sails for my project. Anyone having a working example of how to use a npm pachages vue component

Angular and Sails routing configuration

て烟熏妆下的殇ゞ 提交于 2019-12-22 10:14:05
问题 Is there any Sails.js (or Node) configuration which can prevent Angular routing from working? No matter what approach I take, every rout apart from ones in sails' routes.js return 404. I've tried both 1.2 and 1.3 Angular versions, and I'm using Sails v 0.9.15. All scripts are loaded in correct order (for example): <script src="/linker/js/libs/angular/angular.js"></script> <script src="/linker/js/libs/angular/angular-resource.js"></script> <script src="/linker/js/libs/angular/angular-route.js"

Installing a another Sails.js version locally

回眸只為那壹抹淺笑 提交于 2019-12-22 09:26:14
问题 I've installed Sails.js version 0.9.13 globally on my Mac which runs fine, but I'm trying to fiddle with the 0.10.0-rc4 locally in a folder. Running sudo npm install sails@beta seems to work fine; my node_modules/package.json says "version": "0.10.0-rc4" But when I run sails new testProject in that folder, the generated testProject/package.json says "sails": "0.9.13" . I know that I could just change the testProject/package.json to "version": "0.10.0-rc4" and then npm install but that doesn't

How can I access my models in sailsjs outside a controller?

做~自己de王妃 提交于 2019-12-22 08:37:22
问题 I have a controller that looks like this. module.exports = { readbyslug: function (req, res) { var slug = req.param('id'); Store.findOneByName(slug.split('-').join(' ')) .then(function(err, store){ if(err) res.send({status:'error', msg:'no store'}); res.send(store); }); } }; however, I would rather not have all this login in the controllers, I would rather stick them in another module. My question is, how do I access the models? are they global or something? 回答1: Chadams-- models are global

sails.js + mocha + supertest + sinon: how to stub sails.js controller function

痞子三分冷 提交于 2019-12-22 08:35:08
问题 I am trying to stub a sails controller function, but I don't know which object to stub. using sinon.stub(object,'funcname', function()... This is probably related to the way sails bind controller functions... Here is some code to give example Controller file api/controllers/PersonController.js var fs = require('fs'); // // I want to stub retrieveData function when testing // function retreiveData(cb) { fs.readFile('./filedata', function (err, data) { if (err) throw err; cb(data.toString()); }

Angular $http.delete request with body

故事扮演 提交于 2019-12-22 06:40:42
问题 So I looked at this post: is an entity body allowed for an http delete request Which seems to indicate that while it is 'ok' to do on some conceptual level, in practice it may not be doable because browsers just ignore it. I have some express.js authentication middleware I need to get through, and I don't want to attach my user details to url params. All my other requests that need to authenticate attach these details to the body of the request. Is there some way to force this? I saw some

SailsJS and mySQL custom ID name not working with blue prints

时间秒杀一切 提交于 2019-12-22 06:32:57
问题 I created a new model in SailsJS with a custom id name as the primary key. I'd like to utilize the blue prints routes that come with SailsJS but when I try to go to /name/1 I get the error below. ER_BAD_FIELD_ERROR: Unknown column 'id' in 'where clause' It appears that Sails is still looking for the default table name 'id' instead of my new custom id. Any ideas on how to get Sails to realize my changes? Thank you 回答1: Go to your model definition and add the autoPK:false at last. module

What is the most simple setup for a MEAN stack docker container to have the same config on OS X and DigitalOcean?

蓝咒 提交于 2019-12-22 05:46:22
问题 I am playing around with a MEAN javascript project. (mongoDB + angular + sails.js + node.js) As I am offline a lot of the time, I'd like to keep my dev environment, running in a docker container, on OS X laptop, using boot2docker. The 'production' (not actual production, just somewhere I deploy to to show it to friends) is a Digital Ocean droplet running Ubuntu as host and hopefully the same docker container. I expect that the environment won't change very often and that I can continue using

AppCache misbehaving in Safari, Firefox

好久不见. 提交于 2019-12-22 05:20:19
问题 I'm having some major trouble with AppCache. I've got a single page application (with real URLs using using Page.js and loading HTML from the server on page load, (dispatch: false) It's running on Bode.js, in particular it's a Sails.js app. I've got a manifest file in the HTML tag of the layout. The manifest file has been tested repeatedly and everything checks out. It works flawlessly in Chrome. Even in Safari, it shows up in the inspector correctly and has a list of the assets listed in the

Is it possible to disable blueprint in sails

放肆的年华 提交于 2019-12-22 05:03:05
问题 Is it possible to disable blueprint on certain controllers in sails? I've created a controller and I would like to make it only accessible using the custom route I provided in the routes.js but when I do like controller/action I can still see the page. In the controller I defined _config: {blueprints: {action: false, rest: false, shortcuts: false }} Thanks 回答1: It looks like there's an error in the docs. You no longer need the interior blueprints object for your per-route controller config.