Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
0 votes
0 answers
11 views

How to add security headers in loopback4 web application?

I want to add the following security headers in my loopback4 application. Strict-Transport-Security Content-Security-Policy X-Frame-Options X-Content-Type-Options Referrer-Policy Permissions-Policy ...
veenaMSL's user avatar
  • 111
0 votes
1 answer
60 views

What is the maximum records returned by Lookback 4 regardless of limit clause value?

In loopback 4, I know we can limit records like this ?filter={"limit":10} but what is the biggest value I can set as limit? Also is there a value I can put there which is the same thing as ...
omega's user avatar
  • 43.6k
0 votes
1 answer
487 views

How to add a unique constraints through Loopback 4 Model?

I have a Department model in my project. The properties are id, name. name of course should be unique. However I can't seem to look where the setting is so I can put something like @model() export ...
Irfandy J.'s user avatar
  • 1,436
2 votes
1 answer
493 views

Is there a way to render Loopback 4 "/explorer" in collapsed mode by default

I have installed Loopback 4, and mounted my legacy Loopback 3 app into it as part of my migration - all good so far. However my (swagger-ui shaped) explorer renders expanded by default - and there are ...
batman567's user avatar
  • 879
0 votes
1 answer
40 views

loopback4 application reads loopback3 models after migration

I migrated my loopback3 application to loopback4, as a last step of migration, I migrated loopback3 models, but when I change my model variables in loopback4, migrated application does not read that ...
Alparslan Yılmaz's user avatar
1 vote
1 answer
485 views

How to create custom decorator in loopback4?

async checkUserMemberOfProduct(userId: string, productId: string) { if (userId && productId) { const user = await Product.find({ where: { userId: userId, id: productId } }); ...
Alparslan Yılmaz's user avatar
0 votes
1 answer
330 views

How to create interceptor for default repository methods in loopback4?

When I try to access default repository code I want to control some values before executing the default crud function in repository. How to I achive that? ex: ... @repository.getter('PersonRepository')...
Alparslan Yılmaz's user avatar
1 vote
0 answers
485 views

gyp ERR! : `C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\MSBuild.exe` failed with exit code: 1

I just start learning the loopback and how it woks but getting error while installing the strongloop npm install -g strongloop gyp ERR! build error gyp ERR! stack Error: `C:\Program Files (x86)\...
Aman Chaudhary's user avatar
1 vote
1 answer
860 views

lb4 call another repository in different repository

What is the best way of calling different repository at the main repository? I tried to use Services. For example ... @injectable({scope: BindingScope.TRANSIENT}) export class ProjectService { ...
Alparslan Yılmaz's user avatar
1 vote
1 answer
164 views

How to add NOLOCK for Auto generated SQL queries in Loopback 3

I'm using Loopback 3 and SQL. We've 20 million rows in SQL tables and when we query data using Loopback it's taking a lot of time and further observation we found queries are blocking in SQL. Noticed ...
Prasad Kanaparthi's user avatar
0 votes
0 answers
150 views

Is there a way to send very complex queries in loopback using curl?

I succeed when making simple queries in loopback, using curl, with fairly innocuous use of "or" and "and": curl.exe -s -o %TEMP%\output.json -X GET --header "Content-Type: ...
user1030520's user avatar
0 votes
2 answers
1k views

Call an existing API using Loopback 4

I have a pre-developed API connected to my backend. I am using loopback 4 as a data provider for my react application. I want to call the API using Loopback and get the result in my application. I ...
CoderXT's user avatar
  • 122
0 votes
1 answer
42 views

Which relation type to choose when having array of ids as part of the document

Every order has productIds property which is an array of productIds as explained bellow. How should I implement the relations in StrongLoop \ Loopbck 3? I couldn't find in the document the right ...
Omtechguy's user avatar
  • 3,651
1 vote
0 answers
189 views

My generate files from lb4 openapi cli command doesn't find models folder

My OpenAPI api json files are in ./reference and refer to models in the ./reference/models folder - so when I attempt to generate controllers/models from the API files, it says it can't find the ./...
Manchuwook's user avatar
0 votes
1 answer
18 views

How to create register with relation model embeded?

I'm using Loopback 3 to create my application, with Postgres. I've created a many-to-many usign hasManyThrough relation like this: Product has many Composition Ingredient has many Composition Product ...
Lai32290's user avatar
  • 8,518
1 vote
1 answer
425 views

Loopback hasMany relation is not returning data

I'm using loopback 4 and loopback cli version is 2.2.1 and I'm using MongoDB connector as my data-source, When I try to filter data using API explorer I'm unable to fetch order details , hasMany ...
Lakshmi Narasimhan's user avatar
1 vote
1 answer
403 views

Loopback4 hasMany, keyFrom can be array?

I am trying to use hasMany relationship in loopback. I have problem while using it. I have an array, which is contains to ids from target model and I want to find all elements belongs to that array ...
Alparslan Yılmaz's user avatar
0 votes
1 answer
173 views

"statusCode": 422 should be number in loopback 4

I have json object from angular as {"weight": "50"} but LoopBack 4 needs {"weight": 50}. How can I achieve this? I do not want to make any change in angular. Is there any settings in LoopBack 4? ...
user1635697's user avatar
0 votes
1 answer
117 views

How to alias/override the HTTP path of a default remote-method in Loopback

I have a model players which is extended from the base model User. The player model inherits all the remote-methods from the base model. A new 'User' can be created by a POST /user in the base model. ...
shimin's user avatar
  • 1
0 votes
1 answer
188 views

Loopback 4 exception in authentication

I've followed along the loopback 4 tutorial for adding a jwt authentication to an application. It works but I have a question. At the end of the guide there is : On the picture we add security to ...
Pouissante's user avatar
1 vote
2 answers
1k views

Loopback 4:How to get Parent data based on combination of querying parent and related model

Relation: Customer hasMany Orders Customer id: number name: string Order id: number date: number # assume relation on Customer with "orders" exists. @belongsTo(Customer) customerId: number How to ...
pktippa's user avatar
  • 76
2 votes
0 answers
617 views

Loopback Connector MongoDB - connection pooling

We are using [email protected] version to connect to mongo db . Our database admins are reporting that our application is using more connections and it is constantly growing. When they ...
Arun Cdw's user avatar
0 votes
0 answers
75 views

count number of order every hour with loopback4

Salem, I have tried to return the number of order per hour, so i need to extract the hour in the property createdAt in my order Model that's why i think to use The getHours() method returns the hour ...
H_Hmd's user avatar
  • 25
0 votes
1 answer
23 views

Store variable for specific request on beforeRemote('create' and use it on afterRemote('create'

I want to store variable for specific request on beforeRemote('create' and use it on afterRemote('create'. i know that i can store the variable on the model class variable but i am afraid that it will ...
Omtechguy's user avatar
  • 3,651
0 votes
1 answer
100 views

createOptionsFromRemotingContext globally

Is there an option to specify this method globally so it will affect all the models or i need to specify it for every model i want to use it? Customer.createOptionsFromRemotingContext = function(ctx) ...
Omtechguy's user avatar
  • 3,651
2 votes
1 answer
471 views

Implement API key in loopback 4

I have an API in Loopback 4 that already has authentication implemented by JWT but I want to go one step further by implementing an API key so that only apps that request this API key can use the API. ...
Francisco Buceta Caballero's user avatar
0 votes
1 answer
49 views

Command line interface (CLI) not working after mounting lb3 to lb4 as documented

I mounted lb3 into lb4 app as documented but now i can not use lb cli and getting the following error: "Warning: Found no data sources to attach model. There will be no data-access methods available ...
Omtechguy's user avatar
  • 3,651
1 vote
0 answers
190 views

Refresh token flow : Loopback

How to implement the refresh token flow in Loopback 3.x ? Some have recommended to refresh the 'created' columns of access token table, so the access token does not expire. But this results in a '...
Shivansh Jagga's user avatar
0 votes
1 answer
99 views

How to res.send something in loopback-next

I have a function that has a callback as shown below, and I want to return account that is returned in the callback as a response to the request for the function. How could I res.send the account (...
Vikram Khemlani's user avatar
0 votes
1 answer
726 views

Intercepting all >= 500 error codes in a loopback application with strong-error-handler

I have a simple loopback.js application with strong-error-handler https://github.com/strongloop/strong-error-handler and the following code in middlewares/middleware.json "final:after": { "./...
kosta's user avatar
  • 4,728
1 vote
1 answer
1k views

How can I work with Nested Objects in Loopback 4 using the cli b4 model command

I'm working with deep nested objects that I need to model for using lb4. Any chance I can get help with this sample JSON code? { "cardAcceptor": { "address": { "city": "Foster City", "country": "RU", ...
William Ondenge's user avatar
0 votes
1 answer
86 views

Using hasMany relation and cascading ORM level in loopback4

I have created 2 models Author and Books where Author has hasMany relation with Book and Book has belongsTo relation with author. While saving data using ORM models the cascading is not happening i.e ...
sunilsmith's user avatar
0 votes
1 answer
24 views

How to define an ACL policy applied globally for all models in a LoopbackJS application

Is there a way to define a global ACL which would apply to all models included in the Loopback application? Ideally, this globally defined ACL could be overriden by an ACL defined in a model JSON file....
Johan Mereaux's user avatar
1 vote
0 answers
97 views

What is the difference between CrudRepositoryImpl and DefaultCrudRepository in loopback v4?

There are 2 repository implementation classes in loopback-next repo. The one that is used when a repository is created by CLI is DefaultCrudRepository. We have been using this in many places ...
Samarpan's user avatar
  • 943
1 vote
0 answers
30 views

Creating a flat single relationship in Loopback 3

Loopback has a way to make a light relationship using referencesMany where you can say something like: { "name": "SomeModel", "plural": "SomeModel", // ..., "relations": { "...
tr3online's user avatar
  • 1,429
1 vote
0 answers
272 views

Loopback 4: Explorer error: Could not render n, see the console

I have this error in loopback4 explorer (see the image) Image of the error The API call works (I have try it in postman), but I can use it in the loopback explorer interface. Any idea? In the ...
Jota's user avatar
  • 81
1 vote
0 answers
217 views

No response from the server- Loopback

Sometimes there is no response from loopback. This occurring in both development and production mode. Code is a simple one that used to check whether the user is logged in or not. Also, any console ...
Ashwanth Madhav's user avatar
0 votes
2 answers
460 views

How do you find an item in a repository by something other than id

If I have a repository with many properties and I want to find something by the non-id property, do I just find all and then return the data after a boolean comparison, or is there a better way to ...
Vikram Khemlani's user avatar
1 vote
1 answer
2k views

Save data into existing model instance in loopback

I have a model called ModelA which uses base class Model, not PersistedModel. ModelA contains an existing Model instance which contains the following document. { "_id" : ObjectId("...
Vishnu's user avatar
  • 724
1 vote
0 answers
163 views

Issue with including related Model in loopback

I have two Models Customer and UserProviders In Customer.json, have the following relation "relations": { "userProviders": { "type": "hasOne", "model": "UserProviders", "...
Vishnu's user avatar
  • 724
0 votes
0 answers
333 views

Issue in creating instance method using prototype in loopback

I have two Models, ModelA & ModelB. Model B contains the following properties: "properties": { "firstname": { "type": "string", "required": true }, "middlename": { "...
Vishnu's user avatar
  • 724
0 votes
1 answer
109 views

How to connect manually to MongoDB Database in loopback?

I am trying to connect MongoDB database manually. So how is it possible to get the collection in MongoDB. I need to implement the code in custom js file and not in bootscript. If I include server.js ...
Vishnu's user avatar
  • 724
0 votes
0 answers
201 views

Loopback PeristentModel.findOne returns NaN Error

I am new to Node.js and loopback framework. What I am trying to achieve is find one model instance in loopback (Job Model here) that matches filter specification. Link: https://apidocs.strongloop....
Vishnu's user avatar
  • 724
1 vote
4 answers
437 views

Access Token is not generating when extending User and Access Token Model - Loopback 3

I am new to loopback. So as a part of the learning process, started creating a sample API. Also extended User model as Customer and AccessToken as CustomerAccessToken. But the problem is that access ...
Patric's user avatar
  • 40
0 votes
2 answers
456 views

callback was already called! in loopback, in updateAll function

I'm using the loopback, here while making the update call with list of objects in array. I get in the callback is already called! The scene is, I have defined the callback inside the loop, and in ...
Anupam Maurya's user avatar
0 votes
1 answer
337 views

How can to implement recursion for loopback self relations?

I have a self relation in my model. How to implement recursion for parent-child hierarchy using self-join in loopback upto N-level? The code given below will give us recursion only upto certain ...
Muhammad Naeem's user avatar
0 votes
1 answer
37 views

Looback mongoDB relation in collection, get in ID only (not complete object related to fk)

Hello I am new in Loopback Here I am using loopback, mongodb, currently I have two collection with me, i.e. Company and Employee. In employee collection, I am referring the company as a foreign key ...
Anupam Maurya's user avatar
0 votes
1 answer
2k views

LoopBack 4 REST API example for getting record with Mysql

i'm learning loopback 4, i have created model, repository and datasource, it also connected to mysql and i can retrieve results from http://127.0.0.1:3000/myapi/{id} in my default example getting ...
questionasker's user avatar
0 votes
1 answer
176 views

findOrCreate is not finding data in my db

I created a remote method to make multiple queries to my DB where I want to findOrCreate up to 12 users models at one time. In the loopback explorer I am passing this array, ["player0", "player1", "...
brian c's user avatar
  • 23
0 votes
1 answer
91 views

Loopback get data from one module to anothee

I am using loopback3 for file storage attachment.js and i have the persistedmodel career.js for storing the data. Now i want to fetch the file name in the career.js. how to do this. career.js 'use ...
Sam's user avatar
  • 1,381

1
2 3 4 5
18