Menu
  • HOME
  • TAGS

Migrating built-in models to Databases

loopbackjs,strongloop

Default "db" datasource is placed in memory. That is why your data are not persisted after you restart application. You have to install appropriate database connector and then you have to add datasource for your database inside server/datasources.js. http://docs.strongloop.com/display/public/LB/Connecting+models+to+data+sources If you created application with "slc loopback" command, then your datasource...

Best Practice For Consistent REST Status On Success/Failure (Using LoopBack)

loopbackjs

You should check the HTTP status code instead of depending on the results of the callback (ie. HTTP 200 = OK, 401 = Not Found, etc)

strongloop loopback slow learning curves

javascript,loopbackjs,strongloop

Depending on your requirements, there could be a few steps involved. Run 'slc lb project' to scaffold a Node.js application Add models and configure the datasource. LoopBack automatically creates CRUD methods for you and expose them as REST APIs. You can drop in code into models folder to customize the...

loopback find Users based on they Role

relationship,loopbackjs

There are dynamic roles and static roles. For example, $everyone, $authenticated, $owner are dynamic roles and the isInRole is determined per request. For static roles, the user/role mapping is stored at RoleMapping model. You should be able find all users for a given role at: RoleMapping.find({where: {principalType: ‘USER’, principalId: userId,...

Is it possible to get the current User’s roles accessible in a remote method in Loopback?

loopbackjs,strongloop

This can happen for many reasons, one is that the Role model is not related to your User model (see here for brief explanation). Can you check that? Other than that, it's probably that first argument (context) which we need to have better documentation on ( sorry :( ). If...

How do I access loopback data in the server?

javascript,node.js,socket.io,loopbackjs

Model.find({where: {name: 'John', functoin(err, models)... is an example. See more at http://docs.strongloop.com/display/public/LB/Querying+data#Queryingdata-Nodesyntax...

LoopBack: How to Dynamically Create Custom REST Endpoints In Code (On The Fly)

rest,dynamic,endpoint,loopbackjs,strongloop

You can create a "remote method" within a model's JS file, this adds the API hook "at runtime", although it is at startup. That said, I think you could use the same functions to add the endpoint any time, not just at startup (although I've never tried): Inside /common/models/MyModel.js module.exports...

Loopback passport mobile login

facebook,mobile,passport.js,loopbackjs

I had opened a similar topic about same issue, How integrate loopback third-party login for android. Then found a solution for this. First of all, its important to say that, a loopback user can able to have more access tokens in same time. When you logged in from your web...

Loopback validation on Properties who's types are other Models

strongloop,loopbackjs

At this moment, validations only happen at root level. Can you open an issue at https://github.com/strongloop/loopback-datasource-juggler? BTW, I recommend you post questions to https://groups.google.com/forum/#!forum/loopbackjs for prompt responses....

Loopback return an existing record on PU/UPSERT

postgresql,loopbackjs,upsert

You can extend your API with custom remote method and then use findOrCreate method on your model to return found or created instance as a response. http://docs.strongloop.com/display/public/LB/Remote+methods#Remotemethods-Howtodefinearemotemethod http://docs.strongloop.com/display/public/LB/PersistedModel+class;#persistedmodel-findorcreate Location.findOrCreate( {where: {"name": "Kitchen"}}, data, function(err, instance){ if (err){ console.log(err); } console.log(instance); //this will be your found or created instace based on...

Loopback get http context in an overriden built-in method

loopbackjs,strongloop

loopback.getCurrentContext() - returns not exactly what you assume. Its the per request storage - the wrapper for continuation-local-storage. But for me it returns null too. So to access context with its req & res, you should dig deeper to context implementation or use domains!...

loopbackjs: Attach a model to different datasources

node.js,loopbackjs,strongloop

As @superkhau pointed above, each LoopBack Model can be attached to a single data-source only. You can create (subclass) a new model for each datasource you want to use. Then you can either expose these per-datasource models via unique REST URLs, or you can implement a wrapper model that will...

Loopback - Include a Relation's Computed Properties

javascript,node.js,loopbackjs

Loopback lacks out of the box support for computed properties that are dependent on related models, because related models are loaded asynchronously. However, I wrote a solution to address this problem (pardon the coffeescript): app.wrapper = (model, fn, args)-> deferred = Q.defer() args.push((err, result)-> console.log(err) if err throw err if...

Cannot get or post anything besides login from loopback restful api

javascript,node.js,loopbackjs

I see that you can set some authentication token but I have trouble figuring out how to get that (besides shouldn't it be stored in a session or so when logging in?) See this example I created on authentication and authorization: https://github.com/strongloop/loopback-example-access-control I see that you can set some...

StrongLoop/LoopBack : get full jSON on Rest connector datasource template

node.js,loopbackjs,strongloop

Okay, seems it's clear now. 'Messed up' response is the result of the application of JSONPath expression, result of which is the array, not the JSON Object. You can check some examples here: https://github.com/s3u/JSONPath/blob/master/test/test.examples.js So, if you need just the status you can use this filter: "responsePath": "$.status". Otherwise, you...

strongloop slc deploy env var complications

deployment,loopbackjs,strongloop

strong-pm only sets a PORT environment variable, which the app is responsible for honouring. Based on loopback-boot/lib/executor:109, it appears that loopback actually prefers the PORT environment variable over the value in the config file. In that case it seems your best bet is to either: pass a port in to...

How to Read Query Filters from Within a LoopBack Model

model,loopbackjs,strongloop

Declare filter query paramerter as argument for your formatted remote method and then access it just like callback argument. See how to describe arguments in docs....

Verification code rather than url in loopback

node.js,loopbackjs

There are a couple of ways to do this, but it basically comes down to overriding the user.verify() method (or some portion of it). If you click on that link above and scroll down just a bit you'll see how LoopBack is using the crypto.randomBytes() method to generate the verificationToken...

ACL allowing admin not being searched

acl,loopbackjs,strongloop

Turns out when setting up my test data I wasn't setting the principal id properly. I was using var accounts = [{ username: 'janed', email: '[email protected]', fullname: 'Jane Doe', password: 'secret' }, { username: 'johnd', email: '[email protected]', fullname: 'John Doe', password: 'secret' }]; accounts.forEach(function (account) { Account.create(account, function(err, result) {...

Remote method for updating all records

loopbackjs,strongloop

Query your Employee model, apply filter if you need, then loop through results. Employee.find( filter, function(err,employees) { if(err){ console.log(err); } employees.forEach( function(employee){ fnIncSalary(employee.salary); //do something with employee instance } ); } ); http://docs.strongloop.com/display/public/LB/Querying+data...

Hide LoopBack PUT REST API method

node.js,loopbackjs,strongloop

i think you have to use isStatic = false for method "updateAttributes"...

RemoteHooks with wildcards doen't work in storage container

loopbackjs,strongloop

You can work around it with this for now: Container.beforeRemote('**', function(ctx, unused, next) { if(ctx.methodString === ‘upload’) { ... } } See https://groups.google.com/forum/#!topic/loopbackjs/EI23RYX9C9M...

Add multiple dir for static files in Loopback

loopbackjs

Register loopback.static multiple times in server.js: ... app.use(loopback.static(path.resolve(__dirname, '../client'))); app.use(loopback.static(path.resolve(__dirname, '../other-dir'))); ... The first one has highest precedence. See http://expressjs.com/api.html for more info. You can probably do it with phases too, but I haven't tested this: "files": { "loopback#static": [ { "params": "$!../client" }, { "params": "$!../your-other-dir" } ] },...

How log an HTTP JSON request in Loopback app deployed on Heroku?

node.js,logging,heroku,express,loopbackjs

As loopback extends express, we can use body parser module. So first install "body-parser" Then add this code in serveur.js var loopback = require('loopback'); var boot = require('loopback-boot'); var app = module.exports = loopback(); var bodyParser = require('body-parser'); // parse application/x-www-form-urlencoded app.use(bodyParser.urlencoded({ extended: false })) // parse application/json app.use(bodyParser.json()) var...

StrongLoop Loopback Yeoman Angular

angularjs,gruntjs,yeoman,loopbackjs,strongloop

There is a native $resource to interact with RESTful server-side. Tutorial Also you can use custom build service to combine loopback API and Angular front end: angular.module('catalog', []) .constant('ENDPOINT_URI', 'http://0.0.0.0:3000/api/') .controller('CatalogController', function (ProductsModel) { var store = this; function getItems() { ProductsModel.all() .then(function (result) { store.products = result.data; }); }...

What does 'cb' mean in loopback?

node.js,callback,loopbackjs

So you have an Async function Person.greet which you'll call like this: Person.greet('hello', function(err){ ... }); Notice that after 'hello' a second argument was passed and it is actually a function. It can also be defined outside with a name and passed this way: function callback(err){ ... } Person.greet('hello', callback);...

passing callback or promise to the different module , which one is better and efficient?

callback,promise,loopbackjs

There is no "best practice". However, you will find promises much easier to work with.

Decimal type in Loopback

loopbackjs,strongloop

For model that use mysql connector, this should create column with decimal(10,2) type "amount": { "type": "number", "dataType": "decimal", "precision": 10, "scale": 2 } ...

Auto-create mysql table with StrongLoop

mysql,node.js,schema,strongloop,loopbackjs

LoopBack calls it auto-migration. Check these links and search for that term: Recipes for LoopBack Models, part 5 of 5: Model Synchronization with Relational Databases Data sources and connectors...

Strongloop Loopback: Filter by id of related Model

javascript,angularjs,node.js,loopbackjs,strongloop

I had a similar problem. One recommendation is to open the lb-services.js and try to find: /tags/:id/medias or something similar. Then you will find a comment like this: // INTERNAL. Use Tags.medias() instead. Or something similar. So that is the method that you should call. Do not call the "prototype$__get....."...

findOrCreate in PersistedModal

loopbackjs,strongloop

Based on our conversation, error message and your last comment, your problem is that you mixed loopback model API (server side API) and loopback angularjs SDK (client side). Loopback model API and client API are slightly different. Like error message suggests findOrCreate method does not exists on the client PersistedModel....

How to configure virtual host in loopbackJS?

node.js,loopbackjs

Best option is to use an nginx server. server { listen 80; server_name abc.xyz.com ; location / { proxy_pass http://127.0.0.1:3000; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_connect_timeout 300; proxy_send_timeout 300; proxy_read_timeout 300; } access_log /var/log/nginx/xyz-access_log ; error_log /var/log/nginx/xyz-error_log ; } use this as the virtual host...

What's the difference between embedsMany and hasMany in Strongloop loopback

relationships,loopbackjs

EmbedsMany - a model that embeds many instances of another model; for example, a Customer can have multiple email addresses and each email address is a complex object that contains label and address. A hasMany relation builds a one-to-many connection with another model. EmbedsMany embeds all child objects in the...

Overriding Relation Remote Method In Strongloop Loopback

node.js,loopbackjs,strongloop

I figured out that I can juse add a new remote method the normal way. loopback.remoteMethod( UserModel.prototype.getFollows, { description: 'Get the users who are followed by the user', accepts: [ {arg: 'page', type: 'Number', http: {source: 'query'}, required: true} ], returns: {arg: 'data', type: 'object'}, http: {verb: 'get', path: '/follows'},...

Weird behaviour of loopbackJS with AngularJS

angularjs,loopbackjs

You need to redirect all routes on the server side: In server.js: ... // -- Mount static files here-- // All static middleware should be registered at the end, as all requests // passing the static middleware are hitting the file system // Example: app.use(loopback.static(path.resolve(__dirname, '../client'))); //mount static files first...

strongloop creating related model object in afterRemote method

node.js,loopbackjs,strongloop

Perhaps, you're missing 3rd parameter - next function in afterRemote callback. user.afterRemote('create', function(context, user, next) { ... var Game = app.models.game; game.create({game_blngs_to_userId: user.id, beer_points_required: 0, total_points: 0},function(err, res){ if(err){ console.log(err); next(err); return; } next() // countinue execution }); }); ...

StrongLoop: mutual Model Relations

javascript,loopbackjs,strongloop,loopback

I find it useful to think of creating relationships as extending your API endpoints. If you want an endpoint like api/Events/{eventid}/Venue then create the belongsTo relationship to Venue in Event.

Android Native FB Login with Loopback.io and Passport.js?

node.js,facebook,loopbackjs

The current version of passport.js doesn't have anything which will allow one to simply integrate Android Native FB login with loopback+passport. The reason its difficult to integrate is because when one authenticates using web, the loopback endpoint of FB callback receives a authentication token which it then uses to create...

How do I create a correct hasOne relation between two objects with loopback and angular

angularjs,mongodb,loopbackjs

Seems that you reference undefined property person of usr instance. Create person using User resource, in success callback: function register(email, password, firstname, lastname) { var usr = User.create({ email: email, password: password }, function() { User.person.create({ userId: usr.id }, { firstname: firstname, lastname: lastname }, function(person) { console.log('Persone created:', persone)...

How to protect properties for different roles using loopback

node.js,loopbackjs

Register beforeRemote hook and check if current user is the $owner. Joke.boforeRemote('findById', function(context, joke, next) { // 1. find current user by id, using context.req.accessToken.userId // 2. check if he is owner or not, by Role.isOwner // 3. remove email from returned joke instance if user is not $owner })...

How to Modify the StrongLoop's LoopBack Explorer CSS

css,user-interface,loopbackjs,strongloop

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') })); Copy the directory node_modules/loopback-explorer/public/css to server/explorer/css Customize the copied CSS files as you need. You should lock loopback-explorer's major & minor...

LoopBack Remote Methods and Access to Model Data

node.js,loopbackjs

Typically, you can accomplish most things you'd want to do such as querying and accessing model data (CRUD operations) through the built-in methods that all models get; see http://docs.strongloop.com/display/LB/Working+with+data. Defining a remote method (custom REST endpoint) for these would be redundant. You access the standard model CRUD Node APIs (e.g....

Loopback ACL: Create a User with a Role

javascript,loopbackjs

I know this area of the docs needs some work, and I'm working to improve it as soon as possible. We're also going to clean up and improve the API docs. The Role model inherits all of the CRUD methods from the base DataModel object: http://apidocs.strongloop.com/loopback/#datamodel-new-datamodel. So, for example, Role.create()...

NodeJS Loopback - How do I filter models by its relations

node.js,loopbackjs

You couldn't get EUsers, filtered by property of related model, via EUser.find. Include filter just adds related models to returned instance. Try to add userRole hasMany EUser relation as 'EUsers' and find 'Admin' userRole, including related EUser objects: // assuming that userRole hasMany EUser as EUsers userRole.find({ where: { codeName:...

Loopback - GET model using custom String ID from MongoDB

database,mongodb,model,loopbackjs

Your model setup (with with idInjection: true or false) did work when I tried it with a PostGreSQL DB setup with a text id field for smaller numbers. Running a Loopback application with DEBUG=loopback:connector:* node . outputs the database queries being run in the terminal - I tried it with...

Proper way to combine route and api auth using loopback.js

node.js,authentication,loopbackjs

LoopBack is unopinionated on the session mechanism you use. It simply provides tokens and controls access via token verification. For your case, I assume you want to use the combination of both. Take a look at these two examples for a more in depth tutorial: https://github.com/strongloop/loopback-example-passport and https://github.com/strongloop/loopback-example-access-control and finally...

Createmany in Strongloop Loopback

loopbackjs,strongloop

Loopback "create" method accepts also an array of objects (see PersistedModel.create docs) so you should try creating one "create" call and send an array of OrderItems.

How to use TypeScript with Loopback

javascript,rest,typescript,loopbackjs,strongloop

What is the TypeScript code that will generate the above JavaScript code? You can just use this code as it is (JavaScript is TypeScript). If you are curious about module.export you can use TypeScript's --module commonjs compile flag to get that in a Typeaware manner like this: function personMixin(Person){...

How to design an abstraction model in Loopback

loopbackjs,strongloop

I suggest creating two REST data sources and aggregating the data in a remote method in a custom model. If say you had a generic Calendar model, you can use the Yahoo and Google calendar REST datasources and perform your aggregation in a remote method and have LoopBack serve at...

Using Push Notications in Strongloop

loopbackjs,strongloop

The doc is outdated (I'll fix it). That way of getting the data source is based on the old structure of the push example. You will need to get a handle on your data source differently; typically something like var datasource = app.datasources.db; See Working with LoopBack objects for more...

Can I get to response headers in Loopback afterRemote hook?

express,loopbackjs,strongloop,keen-io

Try to use ctx.res.getHeader('X-Response-Time') method or listen the res.on('finish') event....

Log in user with one-time token using Loopback

javascript,authentication,access-token,loopbackjs

As far as i understand your post, the 'Supervisor' user type has specific email and password, the other user type 'subordinate' does not have specific email password. There is similar scenario in the UserIdentity model's login method. If a user logs in the system with an social network account, UserIdentity...

ACL on certain records instead of API URLs

loopbackjs,strongloop,loopback

If i understand you exactly, your issue could be resolved with 'remote methods' and 'remote hooks'. module.exports = function (Blog){ Blog.getBlogs = function(userid, cb){ // Db operation. // Fetch blogs by userid. cb(null, blogs); }; Blog.remoteMethod('getBlogs', { accepts: {arg: 'userid', type: 'number'}, returns: {arg: 'blogs', type: 'object'} }); Blog.beforeRemote('getBlogs', function(ctx,...

How to create a NodeJS + LoopBack Application using WebStorm?

node.js,webstorm,loopbackjs

Use the command slc loopback and follow the menus with what you need. Then just drag the folder to webstorm. For creating the models it is easy with the terminal too. Every model or stuff you create it will be reflected in WebStorm then you can easily edit there. For...

Amazon S3 browser direct upload unique file name

angularjs,node.js,amazon-s3,loopbackjs

The resulting LoopBack.io remote method now looks like below, setting 'Key' in the parameters did the trick. Project.signS3 = function(filename, cb){ var aws = require('aws-sdk'); var AWS_ACCESS_KEY = process.env.AWS_ACCESS_KEY; var AWS_SECRET_KEY = process.env.AWS_SECRET_KEY; var S3_BUCKET = '...'; aws.config.update({ accessKeyId: AWS_ACCESS_KEY, secretAccessKey: AWS_SECRET_KEY, region: 'eu-central-1', signatureVersion: 'v4' }); // Figure out...

Loopback user model instance has no instance methods

node.js,mongodb,loopbackjs

User.login is a static method, not a prototype method. See https://github.com/strongloop/loopback/blob/master/common/models/user.js#L164. You should be able to use user.constructor.login.

How to define that a model has many of the same model in Strongloop Loopback?

node.js,loopbackjs

The question has been answered by: https://groups.google.com/d/msg/loopbackjs/H7ivcbLAaHo/C9iQop4RXAYJ

Loopback: Cannot find module 'negotiator'

database,node.js,loopbackjs

It turns out that the initial build of the project didn't fully complete. During the initial build, Loopback printed the following: I'm all done. Running npm install for you to install the required dependencies. If this fails, try running the command yourself. create .editorconfig create .jshintignore create .jshintrc create README.md...

Implementing Q with Strongloop Loopback

javascript,node.js,promise,q,loopbackjs

Support for promises are coming into core see: https://github.com/strongloop/loopback/issues/418

How to add more remoteMethod to Built-in Models (say User) in Loopback

node.js,express,loopbackjs,strongloop

There is actually an open issue regarding how to handle this situation better. Right now it isn't pretty, but you can do it. The easiest way given your situation is probably going to be to create a simple boot script to extend User. In server/boot/ create a new file: a-new-user.js...

StrongLoop: EmbedsMany vs hasMany and belongTo

javascript,mysql,loopbackjs,strongloop

Query on model which has EmbedsMany relation will include instance(s) of related detail model in the result. This is because child model will be persisted in a field of the master table, in a form of a document, if you are using SQL database. HasMany stores id of related model...

Strongloop loopback. Cannot add User instance from explorer

javascript,loopbackjs,strongloop

You need to provide a password key (even though it's not listed). Do the same POST /User, but enter these fields in the JSON object instead: { email: "[email protected]", password: "foobar" } These two specifically are required. The rest of the ones you've shown are optional....

hasMany relation loopback

node.js,strongloop,loopbackjs

There are a couple things that might be the problem. Here is what comes to mind: You should only need the foreign key on the model that belongsTo the other one. (In this case, that would be trip.) Have you actually created trips underneath masterTrip? (Either in the code itself...

LoopBack installation failed with error code “ECONNRESET”

node.js,loopbackjs

(Putting this answer that I initially wrote as a comment here because OP says it worked for them.) If, as you say, you are not behind a proxy, etc., install a second time. There may have just been a temporary network blip on your end or anywhere in between you...

error Duplicate data property in object literal not allowed in strict mode

angularjs,strongloop,loopbackjs

You can use the same javascript-object-based syntax as you would in your server-side code: MasterTrip.find( { filter: { include: ['froms', 'tos', 'trips'] } }, function(respoonse) { // etc. }); The URL will contain a single query parameter filter with a JSON representation of the object. If you prefer to keep...

Cannot connect to StrongLoop PM using StrongLoop Arc

node.js,loopbackjs,strongloop

You need to build and deploy your Loopback application (using Arc) before you can manage the processes using Arc. Start Arc from your project directory by calling $ slc arc, and then from the web interface, click "Build and Deploy." You'll also need to run $ slc pm from your...

Can I use loopback of version higher than 2.0 on AWS?

amazon-web-services,amazon-ec2,amazon-s3,loopbackjs

Even if you install the image that comes preconfigured with Loopback 2, you should be able to upgrade to newer versions using npm as you normally would (sudo npm install -g strongloop and the like). Imagine if there's a security issue that you'd need that wasn't backported for whatever reason...Loopback...

Node/Nginx, 413 request entity too large, client_max_body_size set

node.js,nginx,loopbackjs,http-status-code-413

Thanks to Xavier Lucas, problem was indeed with the app and not the nginx config, as suggested in this Github issue: https://github.com/strongloop/loopback/issues/690 Resolved by setting json and urlencoded limits explicitly....

Getting joined data from strongloop/loopback

node.js,loopbackjs,loopback

There should be a relation between your Category model and your Product model. A Category hasMany Products and each Product belongsTo a Category. So your model json files should be something like Category: { "name":"Category", "properties":{ "CategoryId": { "type":"Number", "id":1 }, "CategoryName":{ "type":"String" } }, "relations": { "products": { "type":"hasMany",...

How can I use body-parser with LoopBack?

node.js,express,middleware,loopbackjs,body-parser

After hours of frustration, I just added it to middleware.json like so: "parse": { "body-parser#json": {}, "body-parser#urlencoded": {"params": { "extended": true }} } It is installed as a dependency. Now I have form data in req.body in my routes. My server/boot/routes.js looks like this: module.exports = function(app) { app.post('/mailing_list', function(req,...

How do I get the MongoDb connection from inside Loopback.io

mongodb,loopbackjs

Okay, did a little more digging, mostly into the loopback and mongo connector source code. If you want to get direct access to the mongoDB connection you can, but be careful! module.exports = function(ZipCodes) { ZipCodes.pipeline = function (cb) { //Get the MongoDB Connection var mongodbConnection = ZipCodes.dataSource.connector.db; if (!mongodbConnection)...

Bi-directional model reference strategy

javascript,loopbackjs,strongloop

You'll need to define relations per direction. As you pointed out, user.hasMany.accessTokens doesn't imply accessToken.belongsTo.user. Both need to be defined explicitly. For more information, see http://strongloop.com/strongblog/defining-and-mapping-data-relations-with-loopback-connected-models. ...

How to configure two different datasource for a model in Strongloop Loopback framework?

loopbackjs,strongloop

Try to use attachTo() if you want to change datasource for a single model. For example app.models.YourModel.attachTo(app.dataSources.readDS); readData(); ... app.models.YourModel.attachTo(app.dataSources.writeDS); writeData(); You will have to define readDS and writeDS datasources in your datasources.json file: { "readDS": { "host": "hostA", "database": "dbOnHostA", "username": "user", "password": "password", "name": "readDS", "connector": "mysql" },...

How to generate tables from data source using loop-back?

node.js,mean-stack,loopbackjs

You have to use migrations to create database schema from your datasource or vice versa. There is a post about migrations here. CLI is used to auto-generate (scaffold) code and manage your application. You can find command-line reference here. There is no command to do migration from CLI. ...

Loopback, AngularJS and validation

angularjs,twitter-bootstrap,validation,loopbackjs,strongloop

LoopBack models are unopinionated and therefore do not provide client side validation out-of-box. You should use Angular validation mechanisms before calling $save.

Loopback: return error from beforeValidation hook

loopbackjs,strongloop,jugglingdb

This is a known bug in the framework, see https://github.com/strongloop/loopback/issues/614 I am working on a new hook implementation that will not have issues like the one you have experienced, see loopback-datasource-juggler#367 and the pull request loopback-datasource-juggler#403 ...

StrongLoop Framework - Access-Control-Allow-Origin: *

angularjs,node.js,rest,loopbackjs,strongloop

So as frustrating as this was, I got it figured out. Turns out a detail I left out in my original post was that this application was built using two separate instances of Cloud 9 (http:c9.io), one for the client side and one for the server. I did this because...

How Can I Return a Random Object in Loopback?

node.js,loopbackjs

There is no built-in way. You can do it manually depending on the type of data source you're using. See https://groups.google.com/forum/#!searchin/loopbackjs/random/loopbackjs/C08v1K0NKHk/8nUp9VSGEhEJ...

How to expose the Application model's register method

node.js,loopbackjs,strongloop

Application model doesn't have remote for register() method, to expose it. Instead you should register your own remote method, where you can call Application.register()

Using Non-Rest Calls with Loopback (Strongloop)

node.js,rest,express,loopbackjs,strongloop

Just add it via middleware in server/server.js as you would normally do in a typical Express app. ... // Bootstrap the application, configure models, datasources and middleware. // Sub-apps like REST API are mounted via boot scripts. boot(app, __dirname); app.use('/', function(req, res) { res.send('hello world') }); .... ...

How to expose User.id in JSON response from Loopback

angularjs,angular-ui-router,loopbackjs,strongloop

So, upon a more thorough review of the actual data in the Mongodb database it appears that '_id' in both User and Employee tables were always being populated with "objectid". This made me look at my models more closely. I compared them to the loopback-angular-admin's models--specifically their custom "user" model....

LoopBack JSON Return Inconsistency

json,loopbackjs,strongloop

You should be able to use this for your returns property instead: returns: {type: 'object', root: true}, Basically says the type will be object, and it will be the root meaning no id required. Not sure if you would need to use type: 'array' in your case since you're returning...

Syntax error in loopback api gateway

node.js,gateway,loopbackjs,strongloop

My Problem is solved the problem was that I did not run the API Server http://localhost:3002 where the request was to be sent. I was only running the proxy server whereas there should be an API Server running also to which the request was to be sent.

Trouble setting up a Loopback production host on AWS EC2

amazon-web-services,amazon-ec2,permissions,loopbackjs,strongloop

You can install NodeJS from a PPA using the following commands as documented in this blog post: $ curl -sL https://deb.nodesource.com/setup_0.12 | sudo bash - $ sudo apt-get install -y nodejs The other ideas suggested in the comments also have potential. However, this was the one I was able to...

Loopback custom method call from Android

android,loopbackjs,strongloop

In the examples below, I'll assume your model is called Greeter and the static method Greeter.greet is invoked via GET /greeters/greet?name=Alex. First of all, you need to describe the REST mapping of your method. Then you can call the method using invokeMethod. public class GreeterRepository extends ModelRepository<Greeter> { public RestContract...