How do I Stop a Strongloop Service?

Issue I have two strongloop services running shown here when I check status: user-3340 ~/projects/loopback/places-api $ slc ctl -C http://IPADDRESS:8701 status Service ID: 1 Service Name: placesAPI Environment variables: No environment variables defined Instances: Version Agent version Debugger version Cluster

Continue reading

Custom 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 reading

Issue installing strongloop on Windows 7

Issue After attempting to install strongloop, It threw a few warnings and errors. Command used to install was: npm install -g strongloop Errors: c:\users\yoel\.node-gyp\4.2.4\include\node\v8.h(336): error C2988: unrecognizable template declaration/definition [C:\Users\Yoel\AppData\Roaming\npm\node_modules\strongloop\node_modules\heapdump\build\addon.vcxproj] c:\users\yoel\.node-gyp\4.2.4\include\node\v8.h(336): error C2059: syntax error : ‘using’ [C:\Users\Yoel\AppData\Roaming\npm\node_modules\strongloop\node_modules\heapdump\build\addon.vcxproj] c:\users\yoel\.node-gyp\4.2.4\include\node\v8.h(576): error

Continue reading

How to order the GET response using loopback

Issue I’ve a simple model which looks something like this: { “name”: “reason”, “plural”: “reasons”, “base”: “PersistedModel”, “idInjection”: true, “options”: { “validateUpsert”: true }, “properties”: { “title”: { “type”: “string”, “required”: true }, “position”: { “type”: “number”, “required”: true }

Continue reading

how to apply multiple filters to table using strongloop

Issue please help me in applying mulpiple filters in strong loop http://localhost:3000/api/isoCounts/count?where[flage]=true to this i need to add one more where condition [flage2]=false Solution http://localhost:3000/api/isoCounts/count?[where][and][0][flage]=true&[where][and][1][flage2]=false should work according to the documentation at https://docs.strongloop.com/display/public/LB/Where+filter Answered By – user1859022 Answer Checked By

Continue reading

Promisfy 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 reading

Error "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 reading

Loopback 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 reading

loopback 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 reading

Loopback android sdk fields are null

Issue I have class Item which extends from Model with annotations ORMLite @DatabaseTable public class Item extends Model { @DatabaseField(id = true) public String id; @DatabaseField public String title; @DatabaseField public String details; @DatabaseField public String phone; @DatabaseField(defaultValue = “1000”)

Continue reading

Loopback 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 reading

Is 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 reading

Operation 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 reading

StrongLoop: 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 reading

Strongloop sneakily added property field to acl object

Issue https://docs.strongloop.com/display/public/LB/Define+access+controls In the above tutorial, how did the slc loopback:acl command added the property to the acl object of review? { “accessType”: “EXECUTE”, “principalType”: “ROLE”, “principalId”: “$authenticated”, “permission”: “ALLOW”, “property”: “create” //how did this get added ? }, When

Continue reading

strong-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 reading