Another question is it …

1 minute read

Another question, is it possible to make use of nest cli plugins in an nx workspace (especially when using the angular server builder)

Responses:

like nest/graphql and things like that?

I saw it mentioned here https://docs.nestjs.com/recipes/swagger#plugin

yup

they should work

i remember doing the swagger one

so the docs tell me to add it to my nest-cli.json since nx is doing all the building i don’t have the nest cli or that file :thinking_face:

it looks like the plugin is specifically used to automatically add decorators to classes. If you just do this: ``` SwaggerModule.setup(‘api/cats’, app, catDocument);

const secondOptions = new DocumentBuilder() .setTitle(‘Dogs example’) .setDescription(‘The dogs API description’) .setVersion(‘1.0’) .addTag(‘dogs’) .build();

const dogDocument = SwaggerModule.createDocument(app, secondOptions, { include: [DogsModule], }); SwaggerModule.setup(‘api/dogs’, app, dogDocument);``` in your main.ts file swagger should bootup and show information

but, you’ll have to add decorators yourself

So in short, I can’t use nest cli plugins in an nx workspace right?

let me look into it some more. If we can’t use those plugins properly, I’ll fix it

there’s some helpful information here: https://github.com/nrwl/nx/issues/2147

But I think I can make it cleaner

That seems excessive. Additionally, it’s not possible to change the webpack file for the angular server builder

I realize that nx + nest + angular unversal is uncommon, but it really is annoyingly hard to pull off. If there’s a better place for bigger problems like that I’d be happy to share problems and my solutions there

so you have one entry serving both nest and angular universal?

That’s what I’m doing right now, correct Can’t say it’s nice at all, it seems as if every second change brings the whole thing down

could be easier to have them separate and have a proxy in front of both services

Might be, true Then I would still be stuck in a deployment problem, making that much more complex. And the issue of the resulting file from a build not being able to run standalone would also make this more difficult

that’s true, but deployments could be automated, development cant

for your current situation, you could probably create an issue on the github repo to get more eyes on it

Updated: