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
0 answers

Deep nested validation in loopback models

The loopback docs indicate how to validate models in the REST layer. But, is there a way you can validate deep/nested models inside your model? If a User has both a name and a Contact, I want both to be validated, including all properties defined in…
Carlos Torres
  • 419
  • 2
  • 9
  • 19
2
votes
1 answer

Loopback ctx.instance vs ctx.data

I am not able to understand the difference between Ctx.instance and Ctx.data in loopback 'before save ' callback.
Chandela
  • 262
  • 5
  • 18
2
votes
1 answer

api logout user loopback 4

is there's any clear example of endpoint API logout who allows to delete the token saved in logging In instead of making logging out with the web browser ? i guess there's not any documentation about how the LoopBack generates a default user while…
2
votes
1 answer

How to write unit test for loopback datasource

I wish to write unit tests for my mongodb datasource in my Loopback 4 project, however I could not find any examples. Below is my datasource: import {inject, lifeCycleObserver, LifeCycleObserver} from '@loopback/core'; import {juggler} from…
2
votes
2 answers

Access model method inside express route (Loopback 4)

I will show you an example of what i'm trying to do : server.ts export class ExpressServer { public readonly app: express.Application; public readonly lbApp: ImportedApp; private server?: Server; constructor(options: ApplicationConfig = {})…
Jeremy M.
  • 1,154
  • 1
  • 9
  • 29
2
votes
0 answers

Loopback 4 how access request authorization token header in authorization component

I have a custom authentication strategy in my loopback 4 app. For authorization, I need to access the request authorization token in the authorization component. The token contains user details. So I have to find current user from token and check if…
pratik jaiswal
  • 1,855
  • 9
  • 27
  • 59
2
votes
1 answer

Loopback4 calling HTTPS/REST service with self signed certificate

How do I call https/rest endpoint with self signed certificate in Loopback4 with OpenApi connector? Is there any option to allow such certificate? When I try to call the service.operation(), I get following exception: Unhandled error in GET…
Emilio Numazaki
  • 836
  • 1
  • 5
  • 25
2
votes
1 answer

How can I add parameters to a Loopback 4 JWT payload?

I have a loopback 4 project and I am using @loopback/authentication: ^6.0.0 to add JWT authentication. I followed the official documentaion and I wired it up to my MongoDB. All of this went well and I can secure endpoints. However, progress has come…
chris loughnane
  • 2,648
  • 4
  • 33
  • 54
2
votes
2 answers

Loopback 4 CORS not working despite wildcard

The documentation advises that CORS is enabled by default. But with the default CORS configuration, I am still getting CORS issues. Checking the response headers, no CORS headers are attached. Access to XMLHttpRequest at…
Clement
  • 4,491
  • 4
  • 39
  • 69
2
votes
0 answers

loopback 4 legacy juggler replaceById and updateById adds unwanted id field to embedded documents in mongodb

When i use findById, replaceById or updateById of legacy-juggler with mongodb, an unwanted id field is added to every nested object Steps to reproduce //the model export class NestedDoc extends Model{ @Property() myProp1?: string; @Property()…
2
votes
1 answer

How to do database migrations in LoopBack 4

When the application is in the production stage and it's needed to do changes in tables, I guess doing automigrate is out of the question since it deletes all the data of the tables being changed. Doing autoupdate would be appropriate, but I'm…
Mateus Pires
  • 903
  • 2
  • 11
  • 30
2
votes
3 answers

Loopback 4 won't generate build files

When I try to build a Loopback 4 application with npm run build on Ubuntu 16.04, npm runs lb-tsc for 3 seconds and then just stops without printing any message. After it stops a tsconfig.tsbuildinfo file is generated but the dist folder is not. My…
barkin
  • 179
  • 2
  • 12
2
votes
2 answers

Loopback-4 Add timestamp createdAt & updatedAt through model

I had taken look hooks provided for lower version but I want to know how can I add timestamp createdAt & updatedAt through models without interacting same for timestamps in controller. I had worked on Rails but Loopback-4 is something new to me and…
ray
  • 5,454
  • 1
  • 18
  • 40
2
votes
1 answer

Loopback POST array of entry?

I want to insert 10 entries with one query against 10 queries. I read that it's possible to do it by sending an array like this : But I get this error: Do I need to set something? I don't know what to do at all. Repo with a sample :…
Mathias Osterhagen
  • 402
  • 1
  • 3
  • 19
2
votes
0 answers

How to add the X-Total-Count header with Loopback 4?

I am using React-Admin and I need to add the X-Total-Count in order to manage the pagination, I know it was possible with Loopback3 but I didn't find anything for lb4.
Yvan
  • 1,081
  • 2
  • 20
  • 27
1 2
3
32 33