nestjs

Nestjs Config access to config in bootstrap level

China☆狼群 提交于 2020-12-14 02:32:23
问题 According to this documentation you import your config in AppModule. I'm trying to access to config in bootstrap level in my main.ts file. Something like this: const app = await NestFactory.create(AppModule); if (config.get('swagger.enabled')) { initSwagger(app); } await app.listen(8080); The problem that I don't have access to config in this point, only other moudle will get access to config like this: @Injectable() export class SomeService { constructor(private readonly httpService:

Nestjs Config access to config in bootstrap level

喜夏-厌秋 提交于 2020-12-14 02:27:09
问题 According to this documentation you import your config in AppModule. I'm trying to access to config in bootstrap level in my main.ts file. Something like this: const app = await NestFactory.create(AppModule); if (config.get('swagger.enabled')) { initSwagger(app); } await app.listen(8080); The problem that I don't have access to config in this point, only other moudle will get access to config like this: @Injectable() export class SomeService { constructor(private readonly httpService:

MongoDB query fetch with without unwanted data using NestJS

妖精的绣舞 提交于 2020-12-13 05:50:09
问题 { "_id": { "$oid": "5f244a0c9b20935b3bdc2cd9" }, "user": { "rid": "5f12ba968ca0084ee7f7ea9b", "name": "", "phone": “0123456789” }, "clazz": “Test”, "enrolment_history": [{ "_id": { "$oid": "5f245e2f1906715c9e52d675" }, "start_from": { "$date": "2020-06-30T18:30:00.000Z" }, "expires_in": { "$date": "2020-07-31T18:30:00.000Z" }, "enrollment_date": { "$date": "2020-06-30T18:30:00.000Z" }, "payment_method": "Free", "status": "SUCCESS", "clazz_transaction": "5f3e74f8d26e962003103c11", "month":

MongoDB query fetch with without unwanted data using NestJS

て烟熏妆下的殇ゞ 提交于 2020-12-13 05:49:10
问题 { "_id": { "$oid": "5f244a0c9b20935b3bdc2cd9" }, "user": { "rid": "5f12ba968ca0084ee7f7ea9b", "name": "", "phone": “0123456789” }, "clazz": “Test”, "enrolment_history": [{ "_id": { "$oid": "5f245e2f1906715c9e52d675" }, "start_from": { "$date": "2020-06-30T18:30:00.000Z" }, "expires_in": { "$date": "2020-07-31T18:30:00.000Z" }, "enrollment_date": { "$date": "2020-06-30T18:30:00.000Z" }, "payment_method": "Free", "status": "SUCCESS", "clazz_transaction": "5f3e74f8d26e962003103c11", "month":

Annotating an annonymus middleware in Newrelic in a NestJS app

江枫思渺然 提交于 2020-12-12 05:32:55
问题 I'm using NestJS (with Express Server) for a project and trying to optimize the performance on some of the endpoints, using New Relic I noticed that a big chunk of the response time of all endpoints is spent in an anonymous middleware, reaching 89% at some points. Is there a way to find out which middleware is this? 来源: https://stackoverflow.com/questions/63778644/annotating-an-annonymus-middleware-in-newrelic-in-a-nestjs-app

Is there a way I can use Group By and Count with Type Orm Repository

邮差的信 提交于 2020-12-09 06:42:11
问题 I am new here recently joined and New in Type ORM My code that I am trying FIRST QUERY: I would like to use this approach but not sure how I can group by with count on the column and then order by desc on that column const result = await this.jobViewsRepository.find({ relations: ["jobs"], loadEagerRelations: true, order: { id: "DESC" }, skip: offset, take: limit, } ); I am trying if I can use this in my above query **SECOND QUERY:** **ITS WORKING FOR ME PERFECTLY THE RESULT I AM LOOKING**

How to save relation in @ManyToMany in typeORM

本秂侑毒 提交于 2020-11-25 02:05:06
问题 There are 2 entities named Article and Classification . And the relation of them is @ManyToMany . Here's my question: How to save the relation? My code as below: @Entity() export class Article { @PrimaryGeneratedColumn() id: number; @Column() name: string; @CreateDateColumn() createTime: Date; @UpdateDateColumn() updateTime: Date; @Column({ type: 'text', }) content: string; @Column({ default: 0, }) likeAmount: number; @Column({ default: 0, }) commentAmount: number; } @Entity() export class