My loopback models have a mix of remote methods and non-remote methods. I need to restrict calls in server.js so that only remote methods can be accessed, while denying access to non-remote methods. The code snippet below is from my server.js file. Curren ...
It will keep running even if the condition is met and the code inside return res.json() gets executed. _.each(rooms, function(room){ if(room.users.length == users.length) { return res.json(room); // <-- returns but execution continues } ...
As a newcomer to sails, I am currently exploring authentication implementation. Following the recommended steps, I set up everything and created a basic login form using jade: form(action="/auth/local", method="post") div input(name="identifi ...
In my current project, I am utilizing Sails Js and Mongo DB for development. When a user uploads an image and content for a blog post, I store it in the images folder and save the file destination along with the content to MongoDB. My goal is to display bo ...
Picture this scenario: A customer opens a browser tab and goes to page-x. As the customer remains on this page, I send out data through a socket specific to this page, which we'll call socket-context-x. Next, the customer opens another browser tab ( ...
When looking at the upcoming Sails.js 0.10 release, one exciting feature that stands out is the addition of custom generators (currently @ rc4). You can find a migration guide on Sails' GitHub page highlighting the benefits of these generators, but it lac ...
I am exploring the potential of utilizing the SailsJs framework for nodeJs in order to create an application. Initially, my plan was to construct a REST API in Sails and utilize AngularJs for managing the Front-End. This API would also be beneficial for o ...
I have two models category and inventories and they are associated. The command I used is: Category.find(query).populate('inventories',{select: ['id']}); This command returns the following result: "categories": [ { "inventories": [ { ...
After setting up a fresh Sails application, my intention was to incorporate passport for authentication. However, using sails-auth doesn't seem to generate the necessary files as indicated in the documentation. Sails version: 0.12.14 During the installat ...
The Waterline feature of Sails allows you to designate an entity's attribute as an 'array' type: module.exports = { attributes: { items: { type: 'array' } } } In MongoDB, the $pull operator is available for update queries, enabling the removal ...
Currently, I have a live bidding system in place. On the bidding page, we display both the base price and current bid price of an item. Whenever a user updates the price of an item, I would like that new price to automatically reflect for all customers who ...
I'm facing an issue while trying to set up a basic sails.js application in the Cloud9 environment and connecting it to MySQL. Here are the steps I've followed: Created a Cloud9 project Installed sails: npm -g install sails Created the project: ...
Hello, I am currently developing my rest api app using sails. I came across an interesting article on improving Node.js performance, which you can find here. One of the suggestions in point 2 was to eliminate socket pooling by setting options.agent to fal ...
I am currently working on creating a community platform tailored to a specific local audience, similar to a lightweight "social network." For this project, search engine optimization is not a priority, allowing me to focus exclusively on users who have Jav ...
Currently, I am facing an issue with my user model that requires the implementation of a customToJSON method to remove the password field from the returned JSON object. Everything works fine when I include "responseType" in the "exits" with a value of "jso ...
I have been developing a permissions system for my NodeJS project (Using the SailsJS MVC) and encountered an issue. After resolving my initial error as detailed here, I am now facing a problem where the form is unresponsive. It neither shows an error in th ...
I am currently working on an API built with node.js & express.js. At the moment, the API is unsecured which allows anyone to access and manipulate records using GET, POST, PUT, and DELETE requests. One of the challenges I am facing is that my REST API sho ...
I am currently integrating Stripe with my sails.js server and need to disable CSRF for specific URLs in order to utilize Stripe's webhooks effectively. Is there a way to exempt certain URLs from CSRF POST requirements within sails.js? I have searched ...
Recently, I began a new sails project using 'sails new project --linker'. Initially, everything was functioning correctly but today I encountered a problem. Every time I start the server with 'sails lift', I now receive a 404 error for all my javascript f ...
My Angular controller has a variable called $scope.abc. The backend I'm using is Sails. The initial value of $scope.abc can be set by the backend when the page is first generated. Once the page is displayed, the user may or may not change this value ...
I am looking to integrate the app created using angular-cli with Sails.js. My background is in PHP, so I am new to both of these frameworks. What are the steps involved in setting them up together? How can I execute commands like ng serve and/or sails li ...
Can you explain the distinction between using req.body and req.params.all() within a sails controller? ...
The primary function of the application interface is to provide variables that have been initially posted by the client, as well as any subsequent database calculations carried out in real time by a specialized engine. Is it possible to integrate this eng ...
Can someone help me calculate the distance between 2 coordinates using GMap API? I am trying to figure out how to retrieve data from a URL. https://maps.googleapis.com/maps/api/distancematrix/json?origins=Seattle&destinations=San+Francisco&key={{m ...
Starting with the current setup on my development machine: Node version: 8.4.0 Npm: 5.3.0 (includes Node 8.4) Sails: ~0.12.13 Source control system: Github Deployment host: Heroku I followed this guide: (excluding the heroku git part, utilizing githu ...
As a JavaScript programmer still learning the ropes, I encountered a challenge while working with Sails.js and creating a model. Here is what I have so far: module.exports = { tableName: 'FOO_TABLE', attributes: { FOO: 'st ...
I am a big fan of using SailsJS () for my projects. One of the reasons I like it so much is because it automatically creates a RESTful CRUD API. However, when working with small clients, I often find myself operating in a different environment such as Apac ...
I had initially developed an application with Angular frontend and Sails JS backend. However, I recently separated some of the backend functions into a micro-service using Express. Now, I am looking for guidance on how to call these functions from my mai ...
I've been experimenting with passport-local for authentication in my Sails project. Here is an excerpt from my controller: passport.authenticate('local', function(err, user, info) { if ((err) || (!user)) { res.json({message: 'Unable to authenticate'}); ...
Is there a way to effectively handle dependencies in a Sails.JS project? I have been utilizing the convenient feature that automatically connects assets from the assets folder to the appropriate templates. However, when I use bower / npm install to acqui ...
After extensive research, I have been unable to find the precise answer I am seeking. Upon beginning my journey with Sails app development (a new venture for me), it came to my attention that the framework creates its own frontend using EJS by default. T ...
With no human involvement, both Endpoint A and Endpoint B are standalone Node.js applications operating independently. Endpoint A is tasked with establishing a secure web socket connection with Endpoint B and ensuring it remains active 24/7. Each endpoin ...
I have a Node.js / Sails.js application with a client-side form that submits to a Controller using jQuery ajax: $(function () { $("form").submit(function (e) { e.preventDefault(); var form = $(this); $.ajax({ url: ...
I’m looking to incorporate the following code into a sails js Controller public JsonResult GetEvents() { //Using MyDatabaseEntities as our entity datacontext (refer to Step 4) using (MyDatabaseEntities dc = new MyDatabaseEntities()) { ...
I'm struggling to understand how to integrate dynamic logic into the homepage of my Sails.js application. Currently, the homepage is static, but I want to display data on the index.ejs page. I have a MainController with an index function that retrieve ...
Given the task at hand, I have been presented with the following considerations: Develop a desktop application using Nodeweb kit. Also develop a web application using the same code base. Both applications should have an identical appearance. Both apps mu ...
I'm currently working on sorting my query for the Reddit hot algorithm. The sorting is based on time, and unfortunately I am unable to use beforeUpdate or beforeCreate hooks in this case. I need to incorporate a calculation while querying, but so far I hav ...
I encountered an issue while trying to create a new record. The error message I received is as follows: TypeError: User.create(...).fetch is not a function Below is my UserController.js code snippet for the create function: create: async function(req,r ...
Currently working on a webapp with Sails.js, I am looking for ways to set up different configurations for development and production modes. Initially, I attempted to store the configuration key in config/local.js, but unfortunately, it did not yield the de ...
Currently, I am attempting to understand how promises function in sails. So far, I have been successful in passing data from waterline queries using .then, however, I have run into an issue when trying to use .spread. Specifically, I am receiving a 'f ...
Experiencing a problem where req.target sometimes returns undefined, causing issues with other functionalities dependent on req.target. Seeking assistance to resolve this issue. Appreciate any help! ...
Hello everyone, I am a beginner with Sailsjs-Nodejs. Currently, I have two JSON Objects in my controller that I need to merge/join in order to create a third object to send as a response. The output when using res.send(obj1) is: [ { total_fare: "37 ...
Currently, I am seeking ways to enhance the cache capabilities of my Sails application. Sails generates an Etag with its response. However, despite sending a GET request with an 'if-None-Match' header containing the Etag from the previous respon ...
Can Sequelize be integrated with Redshift? If not, what other options are available? I am searching for an ORM suitable for Node.js that includes transaction support, ruling out Sails.js. While considering Bookshelf as an alternative, it also lacks compa ...
Currently, I'm utilizing SailsJS for my application. Users will input commands through the front-end using NodeWebkit, which are then sent to the server via sockets. Once received, these commands are parsed in the back-end and a specific service/controlle ...
In an effort to enhance security in my system, I decided to implement JWT token authentication. For the front-end, I opted for statellizer. Once a user logs into the system, a token is generated like this: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJlbWFpbCI ...
In my backend development with Sails JS, I am utilizing ES6/7 and have created a class to handle background tasks. After reading a post on StackOverflow (link), it was recommended to initiate background tasks in config/bootstrap.js. Following this advice, ...
I am looking to execute a separate function, like a Service function, before Sails renders the page into HTML. Please refer to the controller code below... var MYController = { index: function(req, res, next) { req.flash("error", "Testing hello ...
When using sails.js framework, which internally utilizes express.js, I encountered an issue while sending a body in a GET request. The command I used was: curl -u username:password -i -H "Accept: application/json" -X GET -d "msisdn=32323" http://localhost ...
An issue has arisen where I need to organize found elements based on the updatedAt field, which is automatically created and updated. Below is the code in question: Model: module.exports = { attributes: { id:{ type: "string" ...
Can Sails.js and/or Waterline support full text search? While PostgreSQL does support full text search, it appears that the PostgreSQL adaptor for Waterline may not have this feature. Is an efficient full text search achievable with Waterline's cont ...
Obtaining data from the API response looks like this: { "ORG_ID":"165", "DEPOT_NAME":"Pesto", "DEPOT_SHORT_NAME":"PSD", "PROD_ID":"709492", "DESCRIPTION":"EX CL (2X14) U17SH365", "PRICE":"3708.55", ...
Recently, I have been working on developing a REST API using Sails.js. As I outlined the resources needed for my application, it struck me that many frameworks (based on Express) are proficient at handling single resources. However, in most cases, I found ...
Note: I have posted an issue regarding this on the Waterline repo, but unfortunately, I have not received a simpler solution than my current workaround. Within my User model, along with default attributes such as createdDate and modifiedDate, I also have ...
When I added my sails.js application to git and cloned it onto another desktop, the application stopped functioning correctly. Although I could run the sails lift command successfully, the login page failed to load properly: https://i.stack.imgur.com/YEhp ...
My SailsJS website has authentication implemented through a form where users are required to input their email and password. This code snippet is inspired by ActivityOverloard 2.0 example code Login login: function(req, res) { console.log("Login hehe ...
I am a newcomer to JavaScript and recently started working with the sails framework. In my middleware, I am attempting to parse the HTTP response body to add a job to the celery queue. Despite following the documentation for skipper-, I continue to encount ...
I am looking to integrate offline sails.js documentation into my system. You can find the official documentation for sails.js maintained at this Sails.js Documentation. According to their documentation, they use doc-templater for building the documentati ...
In my application, I have different parts such as Public API, Admin API, Admin Console (GUI), Private API, and Auth API (oauth2, local, socials). Although these components are distinct from each other, they share the same models. Some routes will experienc ...
Recently diving into Sails JS, I found myself in unfamiliar territory with RESTful APIs. Following the guide, I created a User model to correspond with my existing users table. Adding attributes based on the table's columns was straightforward, and a GET r ...
Currently, I am working on sails and have been able to successfully upload a file from the client to the server without using a form. I am utilizing fs.createReadStream('file') for this purpose. The file data is sent to the server and everything works fine ...
How can I resolve the error I encountered while attempting to install packages using npm? Here is my packages file: "dependencies": { "express": "~3.3.6", "socket.io": "0.9.16", "jade": "~0.35.0", "less-middleware": "~0.1.12", "redis ...
I am currently working on a web application using SailsJS and AngularJS. My project requires session management to track user login status. I came across this helpful tutorial and implemented an index.ejs view located in the /view folder. Within the index. ...
When attempting to include sails-mongo in my Sails project by running npm install sails-mongo --save, I encountered the following error: ~/newWebApp $ npm install sails-mongo --save npm ERR! Linux 3.13.0-24-generic npm ERR! argv "node" "/usr/bin/npm" " ...
Currently, I have an Ember app running on http://localhost:4200 and a Sails app running on http://localhost:1337. In order to set up a pre-signup survey policy in my Sails application, I have the following code in /api/controllers/ProcessSurveyController. ...
Having worked with Django for many years, I became accustomed to the convenience of their automigrations feature. As I recently delved into using SailsJS (a new territory for me), I noticed that it only offers support for alter in database migrations durin ...
Utilizing generators in nodejs is a game changer for me. They really enhance the server-side feel of my code. I've been experimenting with incorporating generators into my Sails app. Here's an example where my controller successfully works when I visit 'ge ...
I recently developed a compact application with Node-WebKit. Now, I am looking to establish a backend service using SailsJS that can facilitate downloading an executable file of my app from a remote server. Can someone guide me on how to create this servic ...
I am currently working on a Sails.js + Angular.js project with a single layout. However, I have come across different HTML files that have a completely different layout compared to the one I am using. The layout file I am currently using is the default la ...
In my MongoDB collection, I have multiple records. Each record contains an array with objects that have various fields. Here is the structure of my collection: [{ "name" : "Karthik Thurairaja", "universities" : [ { "name" : " ...
I am currently using Sails JS (version 0.12.4) on my local Ubuntu machine with the following versions: node -v = v4.5.0, nodejs -v = v4.5.0, npm -v = 2.15.9, and sudo npm -v = 3.10.0 Everything works fine on my local setup, but I'm having trouble in ...
When building an image from a Dockerfile, I encountered an error during the npm installation part of the process. Strangely, I can run the commands successfully outside of the image build environment. The source of this error is still unknown to me. I am ...
Just starting out with sails.js I understand that the inputs object allows actions2 to validate the request parameters. However, how can I access and validate the request body? For example, req.body. I know I can access this from this.req.body, but I was ...
Hey there! So I've been working with the SEMRUSH API and encountered an issue when trying to retrieve data using backlinks_refdomains and backlinks_refips. However, when I called the domain_rank function, it responded in JSON format without any proble ...
Recently, I encountered an issue while using EJS (version - 0.8.4) after making some changes to the file: node_modules/lib/ejs.js at line ~ 155 : The old code looked like this: if (0 == js.trim().indexOf('include')) { var name = js.trim().slic ...