nestjsx / crud

NestJs CRUD for RESTful APIs
https://github.com/nestjsx/crud/wiki
MIT License
4.1k stars 541 forks source link

Global Options Not Working in Nrwl #273

Open mreschke opened 5 years ago

mreschke commented 5 years ago

Global options defined in main.ts of a brand new NestJS project (inside Nrwl NX) don't seem to be taking affect. Perhaps this is because of Nrwl NX somehow?

My nestjs main.ts file looks like so

// NestJSX Global Crud Config must be BEFORE you import AppModule
import { CrudConfigService } from '@nestjsx/crud';
CrudConfigService.load({
  query: {
    limit: 2,
  },
});

import { NestFactory } from '@nestjs/core';
import { AppModule } from './app/app.module';
import { config } from './config';
import { FusionAuthGuard } from '@sun/auth/nest/guards/fusionauth.guard';
import { SwaggerModule, DocumentBuilder } from '@nestjs/swagger';

async function bootstrap() {
  // Create our nest application
  const app = await NestFactory.create(AppModule);
  etc...
omerxx commented 5 years ago

+1

michaelyali commented 5 years ago

@mreschke could you please confirm that you're using this feature as an example here https://github.com/nestjsx/crud/commit/2a6465f353da6f24d16f2e55aa281fb73a354f45 ?

mreschke commented 5 years ago

Yes. Talking about your docs here https://github.com/nestjsx/crud/wiki/Controllers#global-options adding CrudConfigService.load BEFORE the import of main AppModule in the main.ts of a Nrwl Nest project. Just trying to get global configs to take affect and they don't seem to be. Maybe there is a different better place to attempt global options in Nrwl NestJS project?

eranshmil commented 5 years ago

I'm having the same issue, it seems that the decorators are running before the load happens. @mreschke Did you find a way to solve this?

Edit: I moved the load to my CoreModule thats being imported to the AppModule.

lula commented 4 years ago

I'm having the same issue as well.

sinnrrr commented 3 years ago

+1