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
1
vote
1 answer

An argument for 'invokeMiddleware' was not provided

I got this error while implementing loopback4 authentication. constructor ( // ---- ADD THIS LINE ------ @inject(AuthenticationBindings.AUTH_ACTION) protected authenticateRequest: AuthenticateFn, ) { …
veenaMSL
  • 101
  • 1
  • 9
1
vote
1 answer

Database migration in loopback4

I wanted to create database tables from model definition in loopback4. How to do that using loopback4's Auto update functionality?
veenaMSL
  • 101
  • 1
  • 9
1
vote
1 answer

Nodejs - Return from inside promise.then()

continuing to evolve in this new world of NodeJS, I'm trying to do something that seems to be usual but it doesn't work. I have a service wrapper that calls HTTP/REST: getUserById(id: string, attributes: string | undefined, excludedAttributes:…
Emilio Numazaki
  • 836
  • 1
  • 5
  • 25
1
vote
1 answer

On loopback4, how can I avoid Circular Dependency when model B (reports) needs to check all model A (order) data?

On loopback4, how can I avoid Circular Dependency when model B (reports) needs to check all model A (order) data? My loopback4 project contains two models: Order - Order contains hasMany Report Report - Report belongsTo Order On…
fhansen
  • 43
  • 6
1
vote
2 answers

How to add morgan to Loopback 4 RestApplication?

I am simply trying to add morgan to log my http calls. The two methods I have tried are: Adding it to the MySequence class: export class MySequence extends MiddlewareSequence { async handle(context: RequestContext) { const finished = await…
1
vote
1 answer

PM2 doesn't launch Loopback 4 app on DigitalOcean Ubuntu server

I am trying to launch Loopback on Digital Ocean following this tutorial: https://loopback.io/doc/en/lb4/deploying-with-pm2-and-nginx.html The problem is that when I launch it with "pm2 start" command, it seems that pm2 starts, but it doesn't start…
1
vote
1 answer

Loopback 4 - Not able to get metadata from array of classes injected with @inject.tag()

Have a couple of classes registered as services: @processor('some_value') export class MyService {} @processor('another_value') export class AnotherService {} This services are decorated with the processor() decorator, defined like this: const…
Svetljo
  • 303
  • 1
  • 8
1
vote
1 answer

Loopback 4 or typescript unfamiliar syntax

I'm reading the loopback 4 documentation. I also already read typescript tutorials. But I don't get this syntax: module.exports = { model: Product, pattern: 'CrudRest', // make sure to use this pattern dataSource:…
Mon
  • 1,010
  • 1
  • 11
  • 19
1
vote
1 answer

How to implement rabbit mq or bull js in loopback 4

I am trying to implement a background service so that there is less load on the API call. Background task will run to upload files to S3 and send email using nodemailer.
Mohammad Quadri
  • 375
  • 4
  • 12
1
vote
1 answer

Loopback 3 and hook for REST API headers

I have a legacy app which uses loopback 3 and exposes REST API and I wanna get my JWT token from the incoming requests from the clients. I wrote a hook for getting access to the req object to access the…
Ganesh Shenoy
  • 619
  • 1
  • 10
  • 28
1
vote
0 answers

How to update a property of a nested model in loopback 4

I have a nested model like the following, where propertyArray is an array of objects defined in Model2, Model1 is the target of a 1 to 1 relationship, so I am accessing it from the source model repository of the relationship. @model() class Model2…
Matias
  • 11
  • 1
1
vote
1 answer

loopback 4 how to avoid creating more than 5 items in a shopping cart

I am new to loopback 4, and almost all the documentation I found is for lower versions. I have a shopping cart, but I need to avoid it to have more than 5 items... how can I made this constraint? These are my models: import {Entity, hasMany, model,…
assembler
  • 3,098
  • 12
  • 43
  • 84
1
vote
1 answer

How to change Loopback accessToken from queryString to Bearer Token

I'm working on using Loopback to create a mock service. I need this mock service to authenticate using Bearer Tokens. Something like this: curl -X GET --header 'Accept: application/json' --header 'Authorization: BEARER ABCDEFG'…
Brendan
  • 11
  • 1
  • 1
1
vote
1 answer

Passing application object to controllers in LoopBack 4

In the LoopBack 3 docs, it was possible to pass the application object in [model].app (e.g. Book.app). How can I access the application object in the same way in LoopBack 4? I'm trying to dynamically (at runtime) create a controller from another…
1
vote
1 answer

Filter 'where' on global scope inside relations

migrating from lb2 to lb4, skipping lb3 ... A bunch of caveats. Have this filter with many relations inside: { "limit": 10, "skip": 0, "where": {}, "include": [{ "relation": "userRoles", "scope": { …