sails.js

Using passport-steam with sails-generate-auth

好久不见. 提交于 2019-12-23 18:53:33
问题 I'm creating a SailsJS application, and I want users to log in only with Steam authentication. I used sails-generate-auth to create some boilerplate code with sails routes, but I'm having trouble plugging passport-steam into it. https://github.com/kasperisager/sails-generate-auth https://github.com/liamcurry/passport-steam The reported error is: C:\Users\Joe\testProject\node_modules\passport-steam\lib\passport-steam\strategy.js:67 id: result.response.players[0].steamid, ^ TypeError: Cannot

sails.js waterline nested populate query

让人想犯罪 __ 提交于 2019-12-23 16:05:35
问题 I have a find query that returns multiple results of an object, this object contains a model that contains another model, the thing is that waterline doesn't support nested populates, so it populates the first model but not it's inner model. all the examples I've seen for that are for a findOne query, i am looking for a way to resolve that for a find query that returns multiple results. This is my models structure: // Container.js widgets: { model: 'websitewidget' } // WebsiteWidget.js html:

API Versioning in SailsJS

吃可爱长大的小学妹 提交于 2019-12-23 15:47:37
问题 Based on this issue, I have nested controllers and blueprints are disabled. My issue is something like api/Controllers : v1/UserController.js routes.js 'POST /v1/user/register': 'v1/UserController.createUser' Policies.js 'v1/UserController': { '*': [ 'passport'], createUser: ['ModelPolicy','AuditPolicy','reqBodyValidation'] If it is nested controller: while accessing the endpoint : Output is something : error: Sending 500 ("Server Error") response: Error: Invalid route option, "model". I don

SailsJS Waterline with Bluebird Promises

无人久伴 提交于 2019-12-23 09:57:59
问题 When using the waterline ORM, if I want to consume the bluebird promise api thats shipped by default how to I pass the processing back to the controller. Below is the code : module.exports = { //Authenticate auth: function (req, res) { user = req.allParams(); //Authenticate User.authenticate(user, function (response) { console.log(response); if (response == true) { res.send('Authenticated'); } else { res.send('Failed'); } }); } }; module.exports = { // Attributes // Authenticate a user

heroku and sails app | crashes and timeouts

坚强是说给别人听的谎言 提交于 2019-12-23 09:01:58
问题 I have a very basic sails app up and running locally. When I deploy to Heroku, I cannot get a response from the app and then eventually get "Application Error". I sometimes receive "No data received". heroku logs 2015-08-30T22:06:50.949475+00:00 heroku[api]: Release v22 created by me 2015-08-30T22:08:57.324207+00:00 heroku[router]: at=error code=H20 desc="App boo t timeout" method=GET path="/" host=www.ninjalist.io request_id=8e21f6eb-1a59-4e 31-9c40-00aab002d0f1 fwd="118.61.238.166" dyno=

req.headers.origin is undefined

与世无争的帅哥 提交于 2019-12-23 08:54:26
问题 Fairly new to Node and Express. I have a sails.js app that relies on knowing the origin of a request as I need to authenticate the request is coming from a domain that is registered. I've seen in the logs that the origin is empty occasionally, why would this be happening? Is it not a good idea to rely on the origin property, is there another option? Thanks 回答1: The origin may be hidden if the user comes from an ssl encrypted website. Also: Some browser extensions remove origin and referer

“email” validation rule crash sails server - Mongo with Sails.js

妖精的绣舞 提交于 2019-12-23 08:07:21
问题 while the email validation rule fails on module of the sails.js, the server is crashing. Here the snippet of my module: // The user's email address email: { type: 'string', email: true, required: true, unique: true }, And the error as below : err: Error (E_VALIDATION) :: 1 attribute is invalid at WLValidationError.WLError (C:\Users\yuri\AppData\Roaming\npm\node_modules\sails\node_modules\waterline\lib\waterline\error\WLError.js:26:15) at new WLValidationError (C:\Users\yuri\AppData\Roaming

node.js: is there no way to put HTML into i18n-node JSON translation files?

只愿长相守 提交于 2019-12-23 07:45:05
问题 The question says it all. If I put HTML directly into the (JSON-formatted) translation file, like this: "test_html" : "click <a href='http://stackoverflow.com/'>here</a>", I get this in my HTML: click <a href='http://stackoverflow.com/'>here</a> I also tried combining this in my translation file: "test_html_placeholder" : "click %shere%s", With this in my HTML: <%= __('test_html_placeholder', '<a href="http://stackoverflow.com">', '</a>') %> But got similar results. The only thing I can get

node.js: is there no way to put HTML into i18n-node JSON translation files?

会有一股神秘感。 提交于 2019-12-23 07:45:01
问题 The question says it all. If I put HTML directly into the (JSON-formatted) translation file, like this: "test_html" : "click <a href='http://stackoverflow.com/'>here</a>", I get this in my HTML: click <a href='http://stackoverflow.com/'>here</a> I also tried combining this in my translation file: "test_html_placeholder" : "click %shere%s", With this in my HTML: <%= __('test_html_placeholder', '<a href="http://stackoverflow.com">', '</a>') %> But got similar results. The only thing I can get

Using between query for full date format in Sails.JS Waterline

徘徊边缘 提交于 2019-12-23 05:22:20
问题 According to Between Dates using Waterline ORM SailsJS it is possible to do a between query on dates in the Waterline adapter like the following: User.find({ createdAt: { '>': dateFrom, '<': dateTo } }).exec(/* ... */); However, this does only work with date formats like 2018-04-11 . Is it somehow possible to use the full ISO8601 date format in this query: e.g. 2018-04-11T12:45:00.000Z ? EDIT: Added minimal working example code. readDataInDateRange: function(req, res) { var dateFrom = req