2,851 questions
0
votes
0
answers
13
views
can migration from loopback v3 to v4 be done incrementally?
I'm exploring how to migrate my application of loopback v3 to v4. I read through the docs https://loopback.io/doc/en/lb4/migration-overview.html but I'm having trouble to understand:
should my ...
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
...
0
votes
1
answer
118
views
Correctly translate text with Markdown using deepl-node
I am trying to translate XML documents using my NodeJS/Loopback 3 server, as well as the deepl-node library.
My code so far looks like so:
const { Translator, TextResult } = require('deepl-node');
...
0
votes
0
answers
29
views
How to implement conditional Rate Limit in Loopback4?
How to implement conditional Rate Limit in Loopback4?
I am trying to implement a Rate Limit functionality in Loopback4, which is controlled by a condition specified in the controller method metadata.
...
0
votes
0
answers
25
views
Loopback filter : COALESCE
I have a SQL query like this
SELECT name, Id, code, date
FROM Mytable
WHERE code = 'A1'
AND date BETWEEN '2023-07-01' AND '2024-06-25'
AND (name = COALESCE('MyinputName', name));
I want to ...
0
votes
0
answers
16
views
JWT Authentication in multiple schemas
I am using the loopback4 starter repo to test a scenario where I manage my models (like FAQs, Pages, etc) in a separate datasource.
However, I can't seem to authenticate using JWT as it never triggers ...
0
votes
1
answer
384
views
How to handle multiples environments (dev/prod) in one nodejs app?
I'm not sure if it is possible to do something like this.
I have two Reactjs project p1 and p2. For the server, I'm using Loopback3 and MongoDB. Both projects will connect to one server.
What I want ...
0
votes
1
answer
110
views
Loopback `include` generates multiple queries instead of one join query
I have two models Main & Trans (one to one association)
import {Entity, hasOne, model, property} from '@loopback/repository';
import {Trans, TransWithRelations} from '.';
@model({
settings: {...
0
votes
2
answers
88
views
LoopBackJS 3 - Problem with query - Exact ids of Array of objects
How to get conversations that have exact matching ids in the "conversation_members" array using Loopback?
I have a collection in Loopback with the following structure:
"conversation&...
1
vote
0
answers
128
views
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' \
'http://[::1]...
0
votes
1
answer
160
views
Loopback join relation without selecting relation
I'am trying to build a query with loopback 4 with relation between 2 entities
customer.model.ts:
@model()
export class Customer extends Entity {
// id, name properties
@hasMany(() => Order)
...
1
vote
0
answers
232
views
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 ...
1
vote
1
answer
389
views
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 ...
0
votes
1
answer
185
views
how to change the response of api in loopback, how to change in js file corresponding to a json model
I have a model, using postman I am sending request to this model, and in response I am getting the complete record(suppose 25 columns I have), so in response I am getting 25 columns back. I want to ...
1
vote
0
answers
420
views
Helmet is not working to set security headers for static files
I am using loopback , for setting header inside server.js I'm using helmet but its only working for api's but not for static files. What might be the probable cause of this?
0
votes
1
answer
131
views
Loopback-next ReferenceMany Unable to find _id
I have user Model, which reference to ListedStocks,
@referencesMany(
() => ListedStocks,
{},
{
mongodb: {dataType: 'ObjectId'},
},
)
stockIds?: string[];
But when i try ...
1
vote
1
answer
186
views
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?
0
votes
1
answer
190
views
Trying to add dependency json schema using loopback mongodb
I wanted a dependency schema using mongodb loopback.
My Post requests:
REQUEST TYPE 1
{
“url”: “google.com”
“type”: “redirect”
}
REQUEST TYPE 2
{
“url”: “yahoo.com”
“type”: “anchor”
}
...
0
votes
1
answer
169
views
Loopback 3 updating model properties ensure old data is converted correctly without data loss
So I am using Loopback 3 atm, and I am currently updating the properties of my model. Problem is that the structure will be different as before as certain properties are now split into 2 separate ...
0
votes
0
answers
264
views
where condition in loopback 4 with column of other models
I have a query made through the filter on multiple models in cascade. I would like to use a column of the first level (ModelA) in the where conditions of the underlying levels, is it possible?
example:...
0
votes
1
answer
844
views
loopback 4 : patch request blocked by CORS policy
I get an error when I send a patch request to my api (with loopback 4) , all the other request are working fine , i get error only on patch request .
error :
Access to XMLHttpRequest at 'url api' from ...
1
vote
4
answers
2k
views
remove header X-powered-by Express using @types/express
I have to remove X-powered-by Express header, I found theses solution
app.disable('x-powered-by');
or
app.use(function (req, res, next) {
res.removeHeader("X-Powered-By");
next();
});
...
1
vote
0
answers
61
views
Support multiple versions of an API simultaneously (via path)
Question: we've just started to explore loopback, one of our requirements is to host multiple versions of an API simultaneously (e.g. foo.com/api/v1/products, foo.com/api/v2/products). Is this ...
1
vote
0
answers
118
views
How to add no auto rehash option in nodejs mariadb connector?
When i connect to maridb using command line, it takes lot of time to load all the database schema and tables (roughly 10 minuntes). However, adding -A argument in command line saves the time and ...
0
votes
1
answer
373
views
How to remove all frontend files from Loopback app
While developing on a loopback api it is very convenient that the default lp4 app command generates a simple landing page with a swagger api explorer.
But I don't want this when I am finished. where ...
1
vote
1
answer
373
views
Remove nested relations from API explorer (swagger)
I have Application model with following relation:
@belongsTo(() => Ido)
idoId: string;
export interface ApplicationRelations {
ido?: IdoWithRelations;
}
export type ApplicationWithRelations ...
0
votes
1
answer
257
views
Where & Count cant be implemented together in Loopback 4
I am implementing an API that can take out all the data where user_id: user_id
but it is not working please help me to implement the same.
here is my code of Follow_api controller:
@get('/follow-...
0
votes
1
answer
264
views
Loopback 4 - Is it possible to define id property's length?
Using LB4 + MySQL DB through loopback-connector-mysql to create tables on DB.
A
{id: string, name: string}
id
names
0007bc40-814b-11ec-8128-4df48bd1ae4d
John
0007bc40-814b-11ec-8128-4df48bd1ae3d
...
1
vote
1
answer
1k
views
Find/aggregate from another collection based on its _id in mongodb
PetTable {
_id: ObjectId,
bdTable: string,
status: ObjectId(ref=Status)
}
Status {
_id : ObjectId,
statusCode : number, --> exple: (1, 2, ...7)
petId : ObjectId(ref=PetTable),
}
...
1
vote
0
answers
61
views
Loopback custom connector implementation
I am trying to implement a custom loopback connector and it's not clear to me how this all works.
Here are my models:
{
"customer": {
"dataSource": "qb",
"...
7
votes
2
answers
3k
views
MongoParseError: Load balancer mode requires driver version 4+
I have built a loopback 3 app with mongodb, worked perfectly on local and vps. But I wanted to opt for the SaaS (mongodb.com and heroku.com) and now I am facing an error:
/node_modules/loopback-...
1
vote
1
answer
158
views
Is there a way to edit an image before saving it to the database?
Our images are being uploaded by the users on the web application (React) and being saved on the database by our API (Loopback).
The images will be used in our Qt application and they should have ...
1
vote
1
answer
559
views
How can i log request.body in middleware sequence loopback 4?
Am new to loopback, am trying to console request.body in loopback 4 to view the incoming data, but if i print it it prints as undefined, i know i need to use body parser package here, but i can't able ...
1
vote
1
answer
745
views
How do I get the user IP address from the incoming request in loopback 4?
Am new to loopback 4, I want to get the user IP address, their domain details, user agent and the url they are trying to access so on so i wrote a sequence, i have accessed the request context but ...
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 ...
4
votes
1
answer
1k
views
How to write unit test case in loopback 4
I am new to loopback 4. I wish to write unit test cases for my project. However, I could't found proper example where they have used mocking service and using stubs.
Please assist me or share any ...
0
votes
1
answer
90
views
How to get postgres query created by Loopback 4 before it hits database?
I want to sort based on the nested property of Loopback 4. I can't find any direct way in Loopback 4 for this.
http://localhost:3000/pictures?filter={"where":{"and":[{"...
0
votes
1
answer
156
views
How to get users having birthday today in loopback?
I need to send birthday wishes to users in my application.
I have a table "userdetails" with the column "dob". I need a query to retrieve users having a date of birth matching ...
0
votes
1
answer
570
views
How to filter dates based on its time in Loopback 4?
I want to find out all the dates which have time more than 10.30 am.
let whereBuilder = new WhereBuilder();
whereBuilder.gt('sessionStartedOn', '10:30:00');
Obviously, this doesn't work. Are there ...
0
votes
0
answers
502
views
CORS Header missing in Firefox although add_header is used
I have an application that consists of back end and front end. Because of restrictions with the hoster, I need to provide the back end from a different server than the front end.
My back end handles ...
0
votes
1
answer
231
views
How to create relations via repository mixins in loopback 4
I have a requirement where models and repositories can be extended via mixins with the purpose to add fields and relations.
Regarding adding fields to models is already achieved (even with some ...
1
vote
4
answers
495
views
How to use on model into another model
I have two separated models name employee and user with some common data and a accountId to link each other. One record for each model is as below:
Employee
_id:1639137618164
name:"*****"
...
0
votes
1
answer
77
views
PDF returned from Remote method Loopback is corrupted
I am trying to return a file from my remote method:
Visitor.remoteMethod('getVisitorsPDF', {
description: 'Get visitors list in PDF file',
accepts: [
{ arg: 'res', type: 'object', http: {...
0
votes
2
answers
624
views
How to send the pdf file as res in loopback remote method?
I am defining my remote method of loopback as follows
Visitor.remoteMethod('getVisitorsPDF', {
description: 'Get visitors list in PDF file',
accepts: [
{ arg: 'res', type: 'object', http: { source: '...
4
votes
4
answers
651
views
gitignore error while creating loopbackjs app
I downloaded loopbackjs on my windows using the npm command. But while creating an app there is an error showing constantly.
node:events:368
throw er; // Unhandled 'error' event
^
Error: ...
0
votes
1
answer
3k
views
Explicitly set Javascript files mimetype
As I am pretty new to React, need help, please.
I have encountered a use case where the client is uploading a javascript file in the project but upload fails because different browsers see the same ...
0
votes
2
answers
743
views
flattening nested objects typescript
I am looking to flatten a nested object in my controller (new to Loopback and Typescript)
Here is my model :
export class SampleModel {
id: number;
code: number;
guide?: string;
gradeData?: ...
2
votes
1
answer
169
views
What does loopback health really check?
I added the component @loopback/health to my loopback4 server but I don't understand on what it's based to assume my server is up. I searched on https://loopback.io/doc/en/lb4/Health.html#add-custom-...
0
votes
1
answer
477
views
How to receive Post request body and pass that body to my function in loopback
i want to create dynamic model, repository and controller
export async function dynamicModelsDemo(app: any, modelData: any): Promise<boolean> {
console.log("ModelData",modelData);
...
0
votes
1
answer
307
views
Loopback 4: Authorization decoration of CRUDRestController - is it in anyway possible?
Wondering if anybody in the community has any experience or guidance on how one could use
Authorization decorators (or any custom decoration?)(https://loopback.io/doc/en/lb4/Decorators_authorize.html) ...