Questions tagged [loopback4]

Questions about LoopBack version 4. Use this tag for LoopBack questions which are specific to only version 4. General LoopBack questions should be tagged with loopbackjs.

Create powerful APIs easily with a new creation experience for defining REST APIs and handling API requests/responses.

A new, improved programming model with dependency injection and new concepts such as components, mixins, repositories, etc. make this the most extensible version yet.

See also

483 questions
2
votes
2 answers

generated: true not working in loopback 4

I am new to Loopback 4 and I made a model then data-source to MYSQL then repository then the controller (REST), then I visited http://127.0.0.1:3000/explorer/#/TodoController and went to POST section and then tried to insert some data I…
ok.
  • 95
  • 1
  • 10
2
votes
2 answers

How to use socket.io in RestApplication of loopback 4?

I have created my rest application in Loopback 4 and now I want to implement socket in it. Is there any way to do so in RestApplication? export class MyApplication extends BootMixin( ServiceMixin(RepositoryMixin(RestApplication)), ) { …
2
votes
0 answers

In IBM loopback 4, can I use getter and setter for a model property?

When I generate a model with loopback cli (lb4 model) I get a model with some properties. I am specifically trying to make a setter to hash a user entity password. Initially, I get the following code : @property({ type: 'string', required:…
Léo Coletta
  • 1,099
  • 2
  • 12
  • 24
2
votes
0 answers

Expressing loopback relations with swagger

Is there a standardized or recommended way of translating the relations between loopback models to the definitions part of the swagger yaml? Things I'm unsure about: When giving a relation by referencing the other model definition, do circular…
Aljoscha Meyer
  • 527
  • 2
  • 9
  • 19
1
vote
0 answers

How to mock the entire axios object using sinon?

I want to stub the entire axios object using sinon. My axios call is like const response = await axios({ method, url, headers, data, }); I have found out that if my call was like const response = await axios.get(url,…
1
vote
0 answers

How can I use RequestWithSession interface in LoopBack 4 to persist sessions?

I am working on a LoopBack 4 application and I need to persist sessions. I have read that one way to do this is by using the RequestWithSession interface, which extends the built-in Express.Request interface with an additional session property.…
rkoikai
  • 11
  • 3
1
vote
1 answer

SINON Stub findall and scope at same time

I'm trying to mock my sequlize db call Below is the example it('mock db call', async() => { sinon.stub(DBNAME, 'scope').resolves() sinon.stub(DBNAME, 'findAll').resolves(dbDetails) const res = await func1(); sinon.assert.match(res,…
ktn987
  • 11
  • 2
1
vote
0 answers

Keeping getting server and network error when trying to retrieve data from my LoopBack api

When I open my loopback API in Firefox try and use the GET commands for the controllers on my user and plant collection from my mongodb I get this response from the Curl curl -X 'GET' \ …
MrFrieza96
  • 11
  • 2
1
vote
0 answers

LoopBack4 generate uml model diagram

I'm thinking of generate a uml model for all models in my project. I tried the following packages but they didn't work for LoopBack4. loopback-component-model-diagram loopback-component-explorer I added mountPath to component-config.json file.…
1
vote
0 answers

Loopback 4 - JWT authentication - error with given UserRepository

First of all, I have to say I'm new to TypeScript and moreover that since I cannot find a single tutorial about LB and JWT authentication that seems to work correctly from the beginning to the end I had to follow more than one and try to put the…
fudo
  • 2,254
  • 4
  • 22
  • 44
1
vote
1 answer

Loopback 4 - Creating database tables for built-in models?

For LB3 there is specific documentation on how create database tables for built-in models, but for LB4 it seems missing, the closest thing I could find is this page in the migration guide, but it just explain the difference in models persistence…
fudo
  • 2,254
  • 4
  • 22
  • 44
1
vote
0 answers

Loopback4 build with watch takes long

I am using Loopback4 to develop api in Node. I was using the instruction given to build with watch using nodemon It worked, but it was getting slow, like about 15 seconds in my case. I search for other other solution and came up with idea of using…
Azzy
  • 1,717
  • 2
  • 13
  • 17
1
vote
0 answers

Search filter by distance Loopback 4- Nodejs

I want to implement a search filter where user can search by distance. I am storing the lat lng of user in DB. @property({ type: 'string', default: null, }) latitude?: string; @property({ type: 'string', default: null, }) …
callmeizaz
  • 249
  • 3
  • 9
1
vote
0 answers

how to exclude a property of a nested model from openaip schema in loopback 4

I was trying to exclude the property of the nested model on the openAPI schema. Is it possible to do that in the controller with @requestbody() decorator? Example @model() export class ChildModel { @property() id: string; @property() …
naol arega
  • 11
  • 1
1
vote
1 answer

how to use http2 in loopback 4 application?

We are planning to implement http2 in a loopback 4 application. We had used http, socket servers but never http2. What is the procedure to use http2 in my application?
user3170450
  • 375
  • 3
  • 20