strongloop

loopback- how to access from one model to another and send email?

只谈情不闲聊 提交于 2019-12-25 00:06:31
问题 I have the career form where i have all the details with the file attachment. now i can able to store the file. I am able to send email, but both sending email with attachment is not happening because i have two model one is for attachment and the other is Persisted model. In the attachment.js i am able to get the file file name but i could not send email with attachment. Here is code. career.js 'use strict'; const app = require('../../server/server'); module.exports = function(Career) {

upload file and text in loopback

ぐ巨炮叔叔 提交于 2019-12-24 23:32:50
问题 Hello guys i m new too loopback, so don't know if it is possible or not <form> <input type="text" id name="product"> <input type="text" id name="productdesc"> <input type="file" id name="product"> </form> Demo image of form: This demo form i m try to save to database using model rest api (model named as product) Note: just try to save input text field and file path url. i have created a container, using container i can easly upload a file to folder name as storage/file inside server folder.

Loopback: How to add afterRemote of a model to another model

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-24 19:24:34
问题 I have Notification model which looks like this "use strict"; module.exports = function(Notification) { }; And I have another model which is Post: "use strict"; module.exports = function(Post) { Post.prototype.postLike = function(options, cb) { this.likes.add(options.accessToken.userId); cb(null, "sucess"); }; Post.remoteMethod("postLike", { isStatic: false, accepts: [{ arg: "options", type: "object", http: "optionsFromRequest" }], returns: { arg: "name", type: "string" }, http: { path: "

How to change http status codes in Strongloop Loopback

◇◆丶佛笑我妖孽 提交于 2019-12-23 10:59:28
问题 I am trying to modify the http status code of create. POST /api/users { "lastname": "wqe", "firstname": "qwe", } Returns 200 instead of 201 I can do something like that for errors: var err = new Error(); err.statusCode = 406; return callback(err, info); But I can't find how to change status code for create. I found the create method: MySQL.prototype.create = function (model, data, callback) { var fields = this.toFields(model, data); var sql = 'INSERT INTO ' + this.tableEscaped(model); if

How can I get the slc command to work on Ubuntu?

送分小仙女□ 提交于 2019-12-23 09:38:37
问题 I have installed Strongloop using npm install -g strongloop on my Ubuntu 14.04 server. The slc command does not work. It says The program 'slc' is currently not installed. You can install it by typing: sudo apt-get install heimdal-multidev How can I get it to run the Strongloop CLI instead of looking for this package? I have added this to my PATH and it still doesn't work. Any ideas? Other Strongloop commands, like sl-build work and strongloop is listed in npm list -g . 回答1: Ubuntu 14 with

Strongloop with Emberjs

依然范特西╮ 提交于 2019-12-23 09:27:02
问题 Ember Data's REST Adapter accepts the JSON from the server in this format: Taken from the documentation: http://guides.emberjs.com/v1.10.0/models/the-rest-adapter/ { "post": { "id": 1, "title": "Node is not omakase", "comments": [1, 2, 3] }, "comments": [{ "id": 1, "body": "But is it _lightweight_ omakase?" }, { "id": 2, "body": "I for one welcome our new omakase overlords" }, { "id": 3, "body": "Put me on the fast track to a delicious dinner" }] } Is it possible to have this kind of JSON

Npm errors while I try to install dependencies in loopback (strongloop) webapp

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-23 01:22:32
问题 I am new in the NodeJS world. I have created an loopback(strongloop) webapp, but after it I try to run the npm install command in the application's folder I get this output in the terminal (Ubuntu server 14.04 withd newest updates - in a vagrant instance) vagrant@vagrant-ubuntu-trusty-64:/vagrant/example-app$ npm install npm WARN package.json example-app@1.0.0 No license field. npm WARN optional dep failed, continuing ycssmin@1.0.1 npm WARN deprecated jsonstream@1.0.3: use JSONStream instead

strongloop/loopback - Maintain multiple versions of API

我们两清 提交于 2019-12-22 11:08:53
问题 I am using strongloop/loopback for the first time. There is some rudimentary instruction online for versioning an API: var p = require('../package.json'); var version = p.version.split('.').shift(); module.exports = { restApiRoot: '/api' + (version > 0 ? '/v' + version : ''), host: process.env.HOST || 'localhost', port: process.env.PORT || 3000 }; What I don't see, is a recommended way of maintaining multiple versions of an API. So, for example, I could have a legacy 1.4 version and new 2.0

How To Implement ACID Transactions in Loopback

寵の児 提交于 2019-12-21 20:13:39
问题 We've been trying to implement ACID transactions in Loopback without success. The only examples in the documentation use the 'create' method.We've tried completely overriding the events as well as multiple variations of Operation Hooks. We have only been able to get the create example to work. Core Requirement : We need to be able to start a transaction in the create and update methods for a specific model and then update multiple tables in the transaction (either using Loopback's ORM

How to setup OAuth 2.0 server using loopback

北慕城南 提交于 2019-12-21 07:14:32
问题 I want to setup an OAuth 2.0 Server using Loopback using a package called loopback-component-oauth2 The documentation is here : https://docs.strongloop.com/display/public/LB/OAuth+2.0#OAuth2.0-UsingtheOAuth2component But it is very unclear, what models should i create and what rest endpoint should be defined? Please help! 回答1: First of all, it's important to note that the documentation might be outdated: After IBM’s acquisition of StrongLoop, we have integrated strong-gateway with the latest