strongloop

Loopback discoverAndBuildModels not generating models

亡梦爱人 提交于 2019-12-20 12:28:53
问题 I'm trying to get Loopback to discover and build my first table. I've used the simple example on their page at the bottom here: http://docs.strongloop.com/display/LB/Database+discovery+API#DatabasediscoveryAPI-Exampleofbuildingmodelsviadiscovery and I see the output of the table I'm discovering, but the API Explorer doesn't show the table or any newly generated endpoints. Also, the model-config.js file is not updated with the new table object. Here is the basic section of the code done on

Loopback 4: Upload multipart/form-data via POST method

冷暖自知 提交于 2019-12-19 04:02:55
问题 I'm working in Loopback 4 and getting stuck in creating a POST method so that client can call this method and upload a multipart/form-data. I read some examples: https://medium.com/@jackrobertscott/upload-files-to-aws-s3-in-loopback-29a3f01119f4 https://github.com/strongloop/loopback-example-storage But, look like they are not suitable for Loopback 4. Could you help me to upload multipart/form-data via POST method in Loopback4. 回答1: Support for multipart/form-data was added to LoopBack 4

What is the different between using StrongLoop's “slc run” and “node app.js”

风格不统一 提交于 2019-12-19 03:45:36
问题 I'm working through the StrongLoop's getting started instructions and created my sample app. Whilst the instructions tell me to use: slc run . to start my application, I noticed I can equally run my application with: node app.js and get the same result. Obviously by using the second approach I can integrated my StrongLoop application with tools such as forever. So my question is, what extra benefits does slc run offer? Does it have functionalities such auto restart etc? 回答1: You can do more

How to Modify the StrongLoop's LoopBack Explorer CSS

落花浮王杯 提交于 2019-12-17 19:16:42
问题 We're using Strongloop's LoopBack for our REST APIs and would like to modify the CSS for the LoopBack Explorer. However, it's not clear which CSS files are being used (LoopBack vs Swagger) and where they're located. I was not able to find specific documentation for this. 回答1: You can provide your own version of Swagger UI files via options.uiDirs . Edit your server/server.js and add this config option to the explorer: app.use(explorer(app, { uiDirs: path.resolve(__dirname, 'explorer') }));

Something should be wrong with applying of “getter” methods in model-builder.js

混江龙づ霸主 提交于 2019-12-13 10:26:34
问题 I am trying to set-up some basic scenarios and use LoopBack to find out its actual level of flexibility and usability. One of them is the necessity to modify the value of some attributes in resulted JSON objetcs during processing the source data from a db (e.g. MySQL). I am using the following versions: strong-cli v2.5.5 (node v0.10.29) node-inspector v0.7.4 strong-build v0.1.0 strong-cluster-control v0.4.0 strong-registry v1.1.0 strong-supervisor v0.2.3 (strong-agent v0.4.9, strong-cluster

StrongLoop: POST access not being blocked

百般思念 提交于 2019-12-13 07:16:57
问题 I'm using ACL rules to block all types of accesses from all the users. It is working for GET access but it is NOT working for POST accesses. Any idea what could be wrong? Here is the code and sample results: /common/models/client.json { "name": "client", "plural": "clients", "base": "User", "idInjection": true, "properties": {}, "validations": [], "relations": {}, "acls": [ { "accessType": "*", "principalType": "ROLE", "principalId": "$everyone", "permission": "DENY" } ], "methods": {} } GET

Get attached file name in attachment.js using loopback

妖精的绣舞 提交于 2019-12-13 05:39:20
问题 I have the loopback component storage file which is storing the file.Now i want get the attached file name in the attachment.js file. attachment.json { "name": "attachment", "base": "Model", "idInjection": true, "options": { "validateUpsert": true }, "properties": {}, "validations": [], "relations": {}, "acls": [], "methods": {} } attachment.js 'use strict'; module.exports = function(Attachment) { }; I want to print the attached file name in the attachment.js how to do this. 来源: https:/

How to get User information in strongloop using angular.js

冷暖自知 提交于 2019-12-13 05:10:52
问题 I've tried many ways to get the users list/functions using strongloop and the generated angular.js services using lb-ng. Every time I try to get any User functionality, I get a message not authorized. Why would the generated service file contain User functions and not be able to call it from front end. Many articles say it's intentional. Is this a bug or am I doing it wrong? Here's the code I'm using to check duplicate user. angular.module('app') .controller('UserCtrl', ['$scope', 'User',

Loopback post method call

血红的双手。 提交于 2019-12-13 04:10:32
问题 I want to send a post request with loopback "invokeStaticMethod". Please help me how to do it. I want to send a POST API request to below url: localhost:3000/api/user/id/unblock With parameter {"userId", "blockId"} Please let me know how can I send a POST request with Loopback 回答1: You could create a remote method like this: User.unblock = function(id, userId, blockId, callback) { var result; // TODO callback(null, result); }; Then, the remote method definition in the json file could look

loopback include remote method in query

和自甴很熟 提交于 2019-12-13 01:27:37
问题 I am looking for a way to include the result of a remote method when I make a query. For example: I am querying Customer models. To include a related model you would use the include filter { filter: { include: ['orders'] } } . I need to do some processing on some related models before returning results. What I am looking for is something akin to virtual properties from Mongoose. Is this possible or do I have to create a separate request for each customer after results returned? 回答1: You can