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 API's 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 docs here: Loopback 4 Docs

445 questions
9
votes
2 answers

How can I set the mysql table name for a model on loopback 4?

I know that by default loopback 4 infers the name of the mysql database table from the model class or repository class. How can I set the table name to a custom string value? Probably I have to use a decorator, I have not been able to find anything…
Juan Pablo Fernandez
  • 1,669
  • 3
  • 13
  • 23
6
votes
1 answer

Loopback 4: How to inject user in endpoint

I have an endpoint where both users and guests (not authenticated) can post data to: async create( @requestBody({ content: { 'application/json': { schema: { type: 'object', properties: { …
apfz
  • 310
  • 3
  • 21
  • 52
6
votes
0 answers

Custom validation response object in loopback4?

I have added validation rules on a model in loopback. Validations are working fine but the response message i get is somewhat automatically generated. I need to send a custom response object based on a validation. My model validation is multiploof…
TechChain
  • 7,104
  • 20
  • 81
  • 193
6
votes
3 answers

How do I return an error from a Controller in Loopback 4?

I have a controller method // ... inside a controller class @get('/error', {}) async error() { throw new Error("This is the error text"); } The response I'm getting from this error front-end is: { "error": { "statusCode": 500, …
Seph Reed
  • 4,704
  • 7
  • 30
  • 65
5
votes
0 answers

writeConcern warning while using mongodb

I am getting the following warning while using the MongoDB with loopback4. Top-level use of w, wtimeout, j, and fsync is deprecated. Use writeConcern instead. How to solve this. Node version: v12.18.2 MongoDB version: 4.2
5
votes
1 answer

Loopback 4: How to query an array of objects

I have been unable to query objects based on a property in an array of objects. I am trying to query all orders that have the event with id 7: const orders = await this.orderRepository.find({where: {events: {elemMatch: {'id': event.id}}}}); The…
apfz
  • 310
  • 3
  • 21
  • 52
5
votes
2 answers

Schema based Multi tenancy in Loopback 4

Use case In schema based multi-tenant applications there normally is one database with multiple schemas. One schema is the main where the common application data is stored and one for each tenant of the application. Everytime a new customer is…
user3170450
  • 319
  • 2
  • 14
5
votes
0 answers

Which OpenAPI client sdk for loopback4 and angular?

We are currently migrating a loopback3 application to loopback4. The migration of the server is steight forward, but migrating the angular client seems become an issue because of the "sdk". For loopback3 we used @mean-expert/loopback-sdk-builder to…
derdeka
  • 156
  • 5
4
votes
2 answers

Loopback 4 Command line script: The key 'repositories.CurrencyRepository' is not bound to any value in context

Using Loopback 4, I am trying to execute a simple get request after which I want to store some data in my database. I would like to execute the following code from the command line: import {WebshopApplication} from '../application'; import axios…
apfz
  • 310
  • 3
  • 21
  • 52
4
votes
1 answer

Use services in Loopback 4

In Abstract How to use Loopback 4 service generator and create local service class to handle data outside the *.repository or *.controller In Detail I'm developing a system that requires external APIs to fetch data, complex hashing/encryption etc.…
Salitha
  • 596
  • 4
  • 23
3
votes
1 answer

What is the best practice of creating requestBody in loopback 4?

Currently I am working on Loopback4 and I had this issue. @requestBody({ content: { 'application/json': { schema: getModelSchemaRef(LoginCredentials, { title: 'Login' }) }, } })…
3
votes
5 answers

Loopback 4 deployment in heroku, lb-tsc not found error

I'm trying to deploy a loopback 4 app into heroku. But after publishing it npm-start command not working in heroku console. its throwing sh: 1: lb-tsc not found. package.json is as follows "devDependencies": { "@loopback/build":…
3
votes
1 answer

Access express app in LoopBack 4 to add middleware

How can I access the express app instance within a LoopBack 4 application to add a middlware such as helmet or compression via app.use()?
nflaig
  • 412
  • 5
  • 13
3
votes
1 answer

Is it recommended to publish source files for TypeScript node modules?

I noticed some TypeScript node modules (e.g loopback-next/packages) publish their source files with the node module. Is there a particular reason for this or is it just unnecessarily increasing the size of the module?
nflaig
  • 412
  • 5
  • 13
3
votes
2 answers

how to use storage components in loopback 4.0?

i am using storage components in loopback 3.0 to accessing the cloud storage's. but i need how do implement in loopback 4.0.The below link to make it sample in 3.0. https://github.com/strongloop/loopback-example-storage
Santhosh
  • 110
  • 1
  • 13
1
2 3
29 30