Issue I’m configuring Django Pipeline, which I have done before on Linux without issues. On OSX I get the following issue when using Less: CompilerError: env: node: No such file or directory The message comes from the stderr of the
Continue readingTag: node.js
Nodejs memory leak – memory allocation decreased after taking snapshot in chrome debug
Issue I’m investigating a memory leak in my nodejs script, by checking process.memoryUsage().heapUsed, the usage is around 3000MB. chrome://inspect also shows memory usage of around 3000MB. However, every time after I take a heap snapshot, the heap snapshot saved reduced
Continue readingSails.js 0.10.x: Log to file
Issue I want to use the built in Sails.js logger and log everything to a file. The “filePath” variable used to work in 0.9.x in config/log.js, but it no longer appears to work in 0.10.x. Has this feature been removed
Continue readingHow can be logging done for a NodeJS application?
Issue I want to implement logging for my angularjs application with warn info and error modes. Solution using winston module https://github.com/winstonjs/winston var winston = require(‘winston’); require(‘winston-daily-rotate-file’); winston.setLevels({ debug: 0, info: 1, silly: 2, warn: 3, error: 4, }); var fs
Continue readingLogging NodeJS application in production
Issue I am a beginner to Node. Would anyone tell how to handle errors in NodeJS? Also how to define node server to write its logs to a default file instead writing to console. Solution Winston is a good npm
Continue readinglogger.debug is not a function while using log4js
Issue I am using log4js for capturing the logs in node js. My node version is v10.16.3. When i run the code i am getting the error as logger.debug is not a function. Is there any node version compatibility? because
Continue readingHow to log errors to Firebase Cloud Functions Log?
Issue I’m having trouble logging meaningful error messages to my function logs, what I’m trying to achieve is have errors appear with the ‘error’ log level as bellow: Image of actual error log Instead, what I’m getting is this: Image
Continue readingKeep track of specific errors in Google Cloud Error Logs?
Issue I am using GCP with Cloud Run, SQL etc with a Node.js application. I have a specific type of error that appear quite often, related to a Twitter API call. Quite often I get this "Rate limit exceeded" error
Continue readingWhat is the "t=" query parameter in a socket.io handshake
Issue A socketIO handshake looks something like this : http://localhost:3000/socket.io/?EIO=3&transport=polling&t=M5eHk0h What is the t parameter? Can’t find a explanation. Solution This is the timestampParam from engine.io-client. Its value is a Unique ID generated using the npm package yeast. This is
Continue readingLong polling with codeigniter and node.js
Issue I am in a position of researching new technologies , so I heard something about Long polling,node.js. I need to create a web application that which use long polling. On each and every page of this project i need
Continue readingLong polling with codeigniter and node.js
Issue I am in a position of researching new technologies , so I heard something about Long polling,node.js. I need to create a web application that which use long polling. On each and every page of this project i need
Continue readingNode.js long polling request
Issue I’m trying to understand how to consume a remote long polling resource from my Node.js app. I tried with “request” package and the connection keeps open but I cannot read the data which comes from the remote resource. Can
Continue readingHow do longpoll multiple urls using javascript?
Issue The goal is to have multiple longpoll connections open to multiple urls (like example.com/user/1, example.com/user/2, etc) and when data is updated, process it, and reconnect. Here’s a simple example of what I have so far: async function longpoll(url) {
Continue readingHow to use long polling in native JavaScript and node.js?
Issue I need to implement long polling for a chat application. I’ve searched around, but I only find how to implement it in JavaScript using JQuery. How can I implement it using only native JavaScript and node.js? Can you guide
Continue readingSocket.IO server hangs up
Issue I am new to socket.io. So my socket.io server sometimws crashes giving this below error timers.js:103 if (!process.listeners(‘uncaughtException’).length) throw e; ^ Error: socket hang up at createHangUpError (http.js:1360:15) at ServerResponse.OutgoingMessage._writeRaw (http.js:507:26) at ServerResponse.OutgoingMessage._send (http.js:476:15) at ServerResponse.OutgoingMessage.write (http.js:749:16) at XHRPolling.doWrite
Continue readingOnce in a while, axios http long polling not returning at all
Issue I have a function that looks like async function longPoll() { let timeout = 0 try { // perform longPoll tasks let response = await axios.get(config.url) const data = response.data && response.data.data if (!Array.isArray(data)) { return } await Promise.all(data.map(async(item)
Continue readingAlternative to GraphQL long polling on an Express server for a large request?
Issue Objective I need to show a big table of data in my React web app frontend. My backend is an Express server with a GraphQL layer and a few "normal" endpoints. My server gets data from various sources, including
Continue readingController call back function not working in Angular-Express-Bootstrap Seed
Issue I downloaded Angular-Express-Bootstrap seed from https://github.com/jimakker/angular-express-bootstrap-seed. I would like to perform routing through angular js which is performed perfectly. But now I am facing some problem on calling ‘controller’ in controllers.js. I can call my MyCtrl1 by this way
Continue readingMEAN Stack – pass variables from html view to ng-controller
Issue I have developed a profile page which contains several modules such as, let’s say : personal info and friends. Each modules is a ng-controller which makes database calls but I would like to be able to pass the id
Continue readingTrouble declaring and linking a controller together in my app
Issue Link to Github So I have 3 files. There is a source folder which contains my app.js file and also contains folder called Sheets_API_Quickstart, which contains quickstart.js, and a folder called Project, which contains Waiting_List.html I attempted to set
Continue readingSetting ng-controller dynamically from a variable value
Issue I am developing an application using angularJs and nodejs. Am struck at setting the name of the controller to the value of a variable from main controller. To explain it better, my index.html looks like this : <tbody ng-repeat=”group
Continue readingError Multipath Kubernetes Ingress, Cannot GET /
Issue I’m trying to learn about multipath in Kubernetes Ingress. First of all, I’m using minikube for this tutorial, I created a simple Web API using node js. NodeJS Code In this nodeJS, I created a simple Web API, with
Continue readingAngular2 SEO – How to make an angular 2 app crawlable
Issue I am building an Angular 2 app using the Angular-Meteor framework. I would like to achieve fast and consistent indexing by google and other search engines, and allow Facebook sharer and other scrapers to generate previews of my JS-generated
Continue readingProblem with static routing in Node.js using express
Issue I am having an issue with some custom routing code, it all works fine and is in sync with the client-side view routing I do, but as soon as I have a subpage, it doesn’t route my static files
Continue readingflutter web(hosted in nodejs) unable to navigate to other page manually when using setPathUrlStrategy (remove # from url)
Issue I am building a flutter web to serve different pages individually, no internal navigation among pages, users access the page individually as you manually type in the url. I removed the # in url using setPathUrlStrategy (url_strategy: ^0.2.0). Each
Continue readingGET request with parameter dosn't hiting desired route NODE js
Issue The Problem occurs while sending GET or any request with parameters in the URL. for example my index.js const express = require("express"); const bodyParser = require("body-parser"); const app = express(); app.use(bodyParser.urlencoded({ extended: true })); app.get("/:name", function (req, res) {
Continue readingNuxt3 and Firebase Cloud Function Hosting: How to access private key in .env file?
Issue I have a Nuxt3 app that is using "server routes" to create backend APIs to use for the front-end. I have the following server route: server/api/imagekit/deleteFile.js: import ImageKit from ‘imagekit’ const imagekit = new ImageKit({ publicKey: useRuntimeConfig().public.imagekitPublicKey, privateKey: useRuntimeConfig().imagekitPrivateKey,
Continue readingShould be an input data object cloned before it's processed by application logic?
Issue I work on an open source project – object document mapper aka. ODM in javascript and am facing a design decision I struggle with (rather simple but not easy) . In the ODM you can define a Model object
Continue readingAzure Function Node JS unable to read Application Settings returns undefined for process.env.variable_name
Issue Application settings contain the Azure Storage Account Connection string. The function app is designed to generate the SAS token. Have set the Azure Storage Account connection string as part of the Application settings to the function app. When the
Continue readingSinon stub is calling actual function instead of stubbing
Issue I have simple express app in which I’m trying to add test cases for GET route. Somehow the sinon stubbing is not actually working as expected. Below is my code for reference, This is my app.js require("dotenv").config() const express
Continue readingHow to set cache headers only if there isn't an error in sending the response in Node.js
Issue I am doing this essentially: app.get(‘/:id.:ext’, (req, res) => { const remote = bucket.file(`images/${req.params.id}.${req.params.ext}`) // if (isProd) // res.set(‘Cache-Control’, ‘public, max-age=604800’) remote.createReadStream({ validation: false }) .on(‘error’, error => { console.log(error) res.send(`data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7`) }) .pipe(res) .on(‘end’, () => { res.set(‘Cache-Control’, ‘public,
Continue readingClient keeps requesting assets event though Cache-Control havent expired
Issue I have a simple Node server which sets the Cache-Control max-age to 1200seconds and the client requests an image. Even though the 1200 seconds havent passed, if i change the image from server and refresh the page, the image
Continue readingAngular2 with primeng components Nativescript issues
Issue I could able to work on quickstart groceries app from nativescript page. In the login page I have replaced the Angular2 button to primeng button. While convert/transpile the code through TNS command it throws an error on primeng/button.js line
Continue readingLoopback – "Cannot read property 'connector' of null" in Connector hooks
Issue I tried to follow this example https://docs.strongloop.com/display/public/LB/Connector+hooks var connector = MyModel.getDataSource().connector; connector.observe(‘before execute’, function(ctx, next) { // … next(); }); But the property ‘connector’ seems to be undefined. I need to add a connector hook in the boot script.
Continue readingLevel 2 (related model) scope over REST – strongloop api
Issue I found in the documentation that scopes enable you to specify commonly-used queries that you can reference as method calls on a model. Below i have a categories model. I am trying to create scopes that applies to the
Continue readingQuerying from models with HasManyThrough relations – strongloop api
Issue This is a follow up to a previous question. Currently, the api can query from the category and game model which share a relation. For example, through this endpoint /Categories/1001/games/mature I can list all games of fighting category that
Continue readingPaginate Result of related models
Issue This is another follow up to a previous question. There are only two models involved: category and game which share a hasMany relation. Example: The endpoint /Categories/1001/games/mature list all games of fighting category that have mature flag set to
Continue readingUsing Loopback datasources & models without loopback
Issue I envision loopback‘s datasources & models as a useful tool for consuming an API, not just for automatically creating a REST API. Pretend I’m using Spotify’s API. I want a command line application that looks up user information on
Continue readingError-handling – 404 for remoteMethods
Issue I have been able to easily set up a basic node.js api with the help of strongloop. I have been able to add custom routes using remoteMethods. However, I am a bit confused in setting up 404 for those
Continue readingAdding pagination cursor and additional features to endpoint result
Issue Strongloop api has been great to work with right out of the box. However I am currently trying to make some customizations. I am trying to add to the category model a remote method that returns along with the
Continue readingLoopback testing upload file as a user with role
Issue I’ve been writing tests for my loopback backend using loopback-testing project. The backend has set loopback-component-storage in order to provide apis to store files in the filesystem. I want to test file upload using the remote api that loopback-component-storage
Continue readingCustom validation errors gets set multiple times
Issue I created a custom validation for one of my models properties the following way: Model.validateAsync(‘minOsVersion’, validateMinimumOsVersion, {message: ‘Minimum OS Version incorrect’}); function validateMinimumOsVersion(err, done) { var requiredVersion = “some version”; var givenVersion = this.minOsVersion; if (validator.validateSemanticVersionString(givenVersion, requiredVersion) < 0)
Continue readingStrongloop only binds to 127.0.0.1
Issue This question is on similar lines as this – Node.js connect only works on localhost – with the exception AFAIK that the only configuration available in Strongloop is the config.json. I have tried using “0.0.0.0” in the config.json host
Continue readinghow to filter data in include 'model' using strongloop
Issue I am trying to join table ABC with XYZ, and to filter data of included table ‘xyz’ using Strongloop. My code is: return ABC.find({filter:{ where: {abcPropertyName: {neq: ‘1234’}}, include: {**XYZ**: *[{xyzPropertyName: ‘somevalue’}]*}}}).$promise My data-source is: ____abc.json____ “relations”: { “xyz”:
Continue readingHow to install strongloop without internet
Issue Not everyone in our team has internet connection, but installing strongloop using this command requires internet connection npm install -g strongloop Is there a way I can download strongloop first and then install it? Solution npm install -g /path/to/strongloop
Continue readingWhy is loopback throwing the error: The `ModelDefinition` instance is not valid
Issue I am taking Strongloop for a spin. I am just trying the “Getting Started” tutorials, and the basic functionality one would typically want/need. I am using Windows and PostgresSQL, so I created a new datasource and edited the model-config.json
Continue readingMaking authenticated requests
Issue I am using form authentication and role based access. I want to make all the subsequent request as an authentication request using the access token. I refer Loopback-example-access-control example, but not get a clear idea. In this example, they
Continue readingLoopback hasMany relation doesn't work on mongodb
Issue I have some strange behavior after moving from RedHat linux to SUSE on AWS. Everything was working fine, before. Here is my relations: Category: { “name”: “Category”, “plural”: “categories”, “base”: “PersistedModel”, “relations”: { … “professions”: { “type”: “hasMany”, “model”:
Continue readingHow can I Add ACL rules at run time for all model?
Issue I am trying to create acl rules at run-time for all models. I have form that contain ACL information Like: id, model name, property, accesstype, principalId, (here I am assign roldId from role table). PrincipalType. After submit the form,
Continue readingHow does "slc start" determine which js should be loaded?
Issue I can not find any detail explain about which property of package.json it looks at. Normal package.json which have a “main” entry: … “main”: “app.js”, … OK, it i “slc start” it will load app.js. But if i remove
Continue readingStrongloop custom script does not exit
Issue I’m probably overseeing something very basic, but I have this basic strongloop custom script which is suppose to do some data cleanup. The scripts runs fine, this is not the problem, does all it is suppose to do (all
Continue readingHow do I get Loopback to prefer short ids when doing id injection?
Issue I have a loopback app which gives ids like “56dbfa7089223aca7946ca14” when creating models. I would prefer ids like “0” or “73”. Is there a way to adjust id-injection practices to have ids start at 0 and increment as base-10
Continue readingPromisfy loopback models
Issue In unit testing Loopback it is necessary to use callbacks with the upsert methods. So for example … instead of writing something along the lines of this: before(function () { Student = server.models.Student Course = server.models.Course Course.upsert({id: 1, key:
Continue readingError "npm install -g strongloop" in ubuntu
Issue $ sudo npm install -g strongloop > heapdump@0.3.7 install /usr/lib/node_modules/strongloop/node_modules/heapdump > node-gyp rebuild gyp ERR! configure error gyp ERR! stack Error: Can’t find Python executable “/path/to/python”, you can set the PYTHON env variable. gyp ERR! stack at failNoPython (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:401:14)
Continue readingfindOrCreate in Loopback model
Issue I found an interesting problem on loopback. I was confused when I was adding records with findOrCreate. Let’s see the example: for (var x = 0; x < 10; x++) { console.log(x); var Log = app.models.Log; Log.findOrCreate({ where: {
Continue readingGet Status of database operation in 'after delete' hook
Issue Today I ran into an issue where I was unable to determine if a delete operation completed successfully in the ‘after delete’ hook. This is problematic, as it requires an additional database operation to determine if the delete was
Continue readingLoopback Download file
Issue I am following the document for download the file. https://docs.strongloop.com/display/public/LB/Storage+component In that document if download the file means need to follow the url pattern. GET /containers/{container}/files/{file} Example: I have container1 (container name), and file name lb.png. So I maked
Continue readingSet User Role in loopback using loopback-component-passport into inbuilt models
Issue I am trying to create user in loopback using npm loopback-component-passport with user roles based on a condition, If user is having property isAdmin:true he should have role of admin If user is having property isAdmin:false he should have
Continue readingSet User Role in loopback using loopback-component-passport into inbuilt models
Issue I am trying to create user in loopback using npm loopback-component-passport with user roles based on a condition, If user is having property isAdmin:true he should have role of admin If user is having property isAdmin:false he should have
Continue readingloopback include with two models
Issue This current code is working : app.models.AvionPiloteAutorisation.find({ “where”: { “idAvion”: avion.idAvion }, “include”: [“pilote”] }, function(err, pilotes) { … } But this : app.models.AvionPiloteAutorisation.find({ “filter”: { “where”: { “idAvion”: avion.idAvion }, “include”: { “relation”: “pilote” } } }) fail.
Continue readingSame db table for two models
Issue Is it possible to have to models (client, vendor) for one database table? I made a partner model, which uses partner table. My client and vendor models inherit from partner model. http://localhost:3000/api/partners gives back all the data from the
Continue readingstrong-pm always display connection refused
Issue I have installed strong-pm on my remote server and have successfully deployed one strongloop application. I can use sl-pmctl ls to see the service and its id is 1. First, i tested remotely, I get an 502 error. Then
Continue readingHow can I hide the 'id' attribute in Loopback explorer?
Issue Is it possible to hide the id attribute in a method in swagger-ui generated by explorer in Strongloop Loopback? I don want the user to create a new resource and send the id attribute. I know that if the
Continue readingUpdated related objects in Loopback behaving inconsisently
Issue When updating a related object, I get two completely different behaviors from the same code. For example, a question belongs to a student. I run the code below on two separate machines. Question.observe(‘after save’, function (ctx, next) { var
Continue readingSocial Logins authentication through loopback-passport
Issue I am starting to gain grounds with loopback api. Currently I am trying to integrate authentication through social login for my app. I have found three pages that indicate how to accommplish this but they all show this a
Continue readingReferencing a property on a model with node.js in Loopback
Issue Trying to very reference a property in with loopback and considering how much time I have tried to do this, I am clearly missing some fundamental concept. Very simply, I have a Question model which has a points as
Continue readingReferencing one model from another model in node.js
Issue I have two models Question and Answer. A Question has many Answers, and an Answer belongs to a Question. Then in Loopback provides a reference to an Answer. What I can’t figure out is how do I then get
Continue readingLoopbackJS having problems with the collectionsJS module
Issue We are using Strongloop’s Loopback framework to expose some REST APIs. We have different loopback models corresponding to the different REST entities. In loopback model A, we return an array in a API response. In a different loopback model,
Continue readingLoopback update model after save
Issue I want to update last inserted/updated document(row) in “after save” hook without create new instance of that like this: Model.observe(‘after save’, function (ctx, next) { ctx.someProperty = ‘Foo’; ctx.update(); }); How it possible? Solution I’m not sure what you
Continue readingWhat's the difference between hasMany and referencesMany in Strongloop loopback
Issue I read that embedsMany (in case of non relational db) puts the embedded models in the parent model document. While hasMany creates a new collection of child model and a relation is created between parent collection and child collection.
Continue readingIs it possible to remove an operation hook?
Issue Let say I have bind an operation hook for test purpose like the following: it(‘verification link confirms mail’,function(done){ var client = app.models.client; client.observe(‘after save’, function(ctx, next) { if (!ctx.instance.verificationToken){ next(); return; } var link = ‘/api/clients/confirm?uid=’ + ctx.instance.id +
Continue readingStrongloop/Loopback 'slc build –npm' doesn't honor .npmignore
Issue My app has a client and an API in the same repo. The API side is built with slc build –npm, while the client is built with npm run build as triggered within the slc build command. I am
Continue readingLoopback hasOne and hasMany of the same model
Issue I try to make a family tree. I have the model familyMember which should have two relations to it self. First is spouse and second is children. Now I tried it with: “relations”: { “spouse”: { “type”: “hasOne”, “model”:
Continue readingHow can I secure data on record level?
Issue I don’t have much experience with Strongloop but maybe someone can put me in the right direction. In my model I have information of Clients. The Client must have access to their own record but not to the record
Continue readingOperation hook for hasAndBelongsToMany
Issue How can I configure an operation hook, such as after save, when linking or unlinking an instance of the foreign model? Using loopback’s example Assembly and Part model: https://docs.strongloop.com/display/public/LB/HasAndBelongsToMany+relations I would like to execute code when adding (or removing)
Continue readingStrongLoop: ACL for Subtable
Issue I have two tables A and B. A hasOne B, B belongsTo A. Now I have the following ACL in B: { “principalType”: “ROLE”, “principalId”: “$everyone”, “permission”: “DENY”, “accessType”: “*” } When I make a request to localhost/api/B/{id} I
Continue readingStrongloop – add fields to returned user model
Issue Any way to strongloop’s /User/login responce can be extended by UserRoles field? By default strongloop return user object with “firstName, lastName, email, id and userName”, i also need userRoles. Solution You can create a remote hook for the built-in
Continue readingstrong-pm http auth 401
Issue I’ve installed strong-pm on an AWS linux instance: [root@box]# npm -g install strongloop strong-pm [root@box]# sl-pm-install –http-auth user:pass –force –upstart 0.6 –set-env NODE_ENV=production [root@box]# /sbin/initctl reload-configuration [root@box]# /sbin/initctl restart strong-pm strong-pm start/running, process 18171 When I attempt to check
Continue readingStrongloop: setup Storage Component for Amazon S3
Issue I’m new to Node.js and Loopback. I have been using Deployd so far and I’m trying to migrate to Loopback. The S3 bucket module on Deployd was working great. So…: I’m on this website https://github.com/strongloop/loopback-component-storage I run, in my
Continue readingJavaScript not executing file in models folder
Issue I have generated an app using strongloop and added the following code in user.js // user.js console.log(“came here”); module.exports = function(app) { console.log(app); }; Why I cannot see any console? Why is this file not being included while running
Continue readingloopback-storage-component how to display picture – file
Issue I am using loopback-component-storage for uploading images to server. https://docs.strongloop.com/display/public/LB/Storage+component I have also AngularJS JavaScript SDK so my lb-services.js is dynamically updated. https://docs.strongloop.com/display/public/LB/AngularJS+JavaScript+SDK Now I want to display in my webpage the photo from this loopback component storage model,
Continue readingPlacing a pop out message once function has finished
Issue How can I place a pop out message like ‘message sent successfully’ once the function has finished running in this case (smsAll)? controller $scope.smsAll = function() { $scope.smsStatusZeroF2F = “”; $scope.smsStatusMoreThanTenF2F = “”; $scope.smsStatusBetween14F2F = “”; if ($scope.isSMSzeroF2F) {
Continue readingIBM API Connect apps published to Bluemix inaccessible
Issue I followed API Connect getting started guide to create a local loopback API app and tested successfully. Then I am trying to follow Publish Your API to Bluemix. The publishing is successful. The app is running. But clicking the
Continue readingCannot Get specific file from s3 using Strongloop
Issue I can upload, delete and get list of folders from container(s3) but not able to get specific file from amazon S3 using Strongloop. My code: $scope.getS3Files = function(myfolderName){ //have to get all zip files in myfolderAbc $http.get(‘api/basePath/containerABC/files/folder1/myfolderAbc=’ + myfolderName).then(function
Continue readingTemperamental `nestRemoting()` sometimes can't find relation
Issue I’m implementing the (not so well documented) loopback method nestRemoting() as follows: module.exports = function(MyModel) { MyModel.on(‘attached’, function() { MyModel.nestRemoting(‘relationName’); }); } However this seems to be very temperamental. Sometimes it works, but most of the time I get:
Continue readingExecute raw query on MySQL Loopback Connector
Issue How is it possible to execute raw query and expose results through REST API with strongloop? I’ve read something about using hooks and dataSource.connector.query() but I cannot find any working examples. Solution Here is a basic example. If you
Continue readingShowing button based of specific log in id
Issue For now, i am able to hide the button if the user is not logged in and it’ll show when the user is logged in using the ng-show tag in html page. But what i want is the button
Continue readingStrongloop API query by base model
Issue We have multiple models with a common base model. E.g. creature as a base, and animal and human as sub models, inheriting from creature. Is there a ready-to-use method to query for all creatures (be it human or animal)
Continue readingModify image obtained from loopback-component-storage
Issue I am using loopback for storing Image to the server. I want to modify the file name of the file before getting saved to the server. Also I want to convert it to another thumbnail form before getting saved.
Continue readingAPI gateway for rest API?
Issue I have a rest API which developed with loopback framework. And my datastore is mssql. What are my options for API gateway which is easy to integrate? Kindly suggest Solution I was referring to any api gateway such as
Continue readingHow to write remote hook for a method with parameter and relation
Issue I went through the remote hook documentation, I can successfully create remote hooks for methods without extra parameters, like login, which is: customer.afterRemote(‘login’, function(ctx, modelInstance, next) { if (ctx.result) { … next(); } else{ next(); } }); Now, How
Continue readingWhat's the difference between Loopback's operation hooks vs events?
Issue Loopback seems to have overlapping concepts when handling certain points of time in an model’s lifecycle: https://docs.strongloop.com/display/public/LB/Operation+hooks Applied through Model.observe vs https://docs.strongloop.com/display/public/LB/Events#Events-Modelevents Applied through Model.on Both seem to have similar ways of handling CRUD events. What’s the difference between
Continue readingStrongloop related model returns function, not object
Issue I try to make request to mongoDB: GeoData.find({ include: {relation: ‘Account’} , where: { and: [{ Coordinate: { near: alarm.Geopoint, maxDistance: maxDist.Value, unit: ‘meters’ } }, {Time: {gt: fromTime}}] } },function(err, datas){ _.each(geoDatas, function(val){ console.log(val); //line 1 console.log(val.Account); //line
Continue readingSet property before update
Issue I read Operation hooks and understood the concept of “not tied to a particular method”. So i would like to know if is possible to set a property before update a model. I have a updatedAt property in my
Continue readingLoopback <model>.verify is not a function\n
Issue So, I read the documentation about manage the users. I also comes from this example: link. Then I try to make a model, called user-basic which bases on built-in model User. Here’s the user-basic.json: { “name”: “user-basic”, “base”: “User”,
Continue readingWrite filter condition in StrongLoop with [and] and [or] conditions together
Issue I’m trying to filter data using “and” and “or” conditions. I would like to get this mySql query: SELECT * FROM `data` WHERE ((`property1`=11) OR (`property1`=13)) AND (`property2`=6) The rest api filter that I wrote is like this: filter[where][and][0][or][0][property1]=11&filter[where][and][0][or][1][property1]=13&filter[where][and][1][property2]=6
Continue readingLoopback use a relation's remote method
Issue I am using loopback in my project and I have a MyUser model related (hasMany) to a SellerRequests model. I see that I can now make a POST on /api/MyUsers/:id/sellerRequests to create a new sellerRequest linked to the user
Continue readingloopback parent model – how to set properties and create child models
Issue I have several loopback models and I want to add shared functions to them. I’m not really sure if I understand loopback’s extend approach, but I created a Dictionary model, set other models base property to Dictionary and got
Continue readingHow do i setup SMTP with Loopback.io
Issue How to setup SMTP server with loopback.io mbaas? i have gone through all the documentation but i couldn’t find it. How to give/define my smtp server settings in loopback config file if there is way to do so. Solution
Continue readingUser infomation in Loopback
Issue I’m making a games backend in loopback. I have a user model defined as such. { “name”: “player”, “base”: “User”, “idInjection”: true, “options”: { “validateUpsert”: true }, “properties”: { “name”: { “type”: “string”, “required”: true } }, “validations”: [],
Continue reading