Category "nestjs"

Return many files with json from backend to client

I want to know may i respond to client from backend controller with many files (with application/octet-stream). It will be more better, if i respond array of fi

How to pass a dynamic port to the Websockets-gateway in NestJS?

I wanted to dynamically set the Websockets-gateway port from config in NestJS. Below is my websockets-gateway code. import { WebSocketGateway } from '@nestjs/we

How to provide a Guard for a specific Module in Nest.js?

I have a module called AdminModule which should be protected by AdminGuard. I tried to set up the Guard directly in the module like this: @Module({ imports: [

How to test NestJs response interceptor

I tried to follow this thread but it I keep getting an error. transform-response.interceptor.ts: import { Injectable, NestInterceptor, ExecutionContext, CallHan

How to fix CORS Error when using the Nest JS framework

I added cors package in the main.ts. but still it's throwing error. I don't understand why this error throwing can you pls explain how to properly handling cors

Typeorm. use only the date part while querying via date and exclude the timestamp part

I have a use case where I have to retrieve a users record from the database via his date of birth. The thing is that we have stored the date of birth of the use

GraphQLError: Query root type must be provided

I'm using NestJS, TypeORM and GraphQL for my backend API. I'm getting the following error: GraphQLError [Object]: Query root type must be provided. at Sch

how to I get a user's IP address when separate client and server apps, in Node with Nest.js

I have two apps, one front end (react.js) and one a REST API back-end(nest.js based on express.js). How do I get the IP address of the user accessing the back-e

NestJs: Unable to read env variables in module files but able in service files?

I have an .env file at the root of my NestJs project with some env variables in it. The strange thing is that I am able to read the variables in service files

NestJs: Unable to read env variables in module files but able in service files?

I have an .env file at the root of my NestJs project with some env variables in it. The strange thing is that I am able to read the variables in service files

Nestjs create Generic CRUD service

I want to create a base service using a generic class which I wrote below: import { BaseEntity } from './base.entity'; import { Repository } from 'typeorm'; e

nest.js build throwing a lot of errors

I have this Nest.js app running and setup for a while and, out of a sudden, it started reporting this when I run npm run build. node_modules/@nestjs/config/dist

Guard factory in nestJS application

I'm trying to create a guard factory in order to create a guard based on given params and ran into an issue. I built the following factory @Injectable() export

Is there a way to use configService in App.Module.ts?

I am building RESTful service with NestJs, I have followed the example to build configurations for different environments. It works well for most code. However

How to query for manyTomany relation in typeorm?

I m trying to fetch user details using typeorm in nestjs below are the tables in mysql database user table id (PK) email 1 [email protected] 2 [email protected] role table

Pagination and filtering in TypeScript and TypeORM

How can i create an function to pagination and filtering with typeorm? I use queryBuilder() but i don't how to create an function to divide the results into pag

How to put a foreign key in knex migration?

I'm trying to put a foreign key in knex migration. "age_group_id"(primary key of the "agegroups" table) is the foreign key of the "users" table. So, I have put

Select specific columns from jeft join query, TypeORM

I have a task to get key information about users in database. There are many left joins and the query works quite slow. I'm trying to optimize it somehow and I

CQRS and cross cutting concerns like ABAC for authorization reasons

Let's assume a monolithic web service. The architectural design is based on the DDD and divides the domain into sub-domains. These are structured according to t

Upload in GraphQL with NestJs and ValidationPipe

Im trying to make file upload in my api using this strategy: https://stephen-knutter.github.io/2020-02-07-nestjs-graphql-file-upload/. Without the ValidationPi