简体   繁体   中英

Creating NestJS Controllers and Modules in a NX Workspace

I am using the NX workspace's angular-nest boilerplate to get started with an App. Whenever I try to use the CLI or the NX extension to generate a controller/module etc, it gets placed in the wrong folder.

https://i.imgur.com/MbOhdgU.png

For instance, if I generate a new module for nest, I would like it to be placed in api/src as that is where the Nest files are. But in my case if I use the command nest generate module helloworld , it gets placed in the src/helloworld folder outside of the api/src folder.

Is there a simpler way to make it so that my Nest components and modules etc are generated in the Nest folder and Angular components etc are in the Angular folder?

use the "NX console" extension ( which I see you already installed... ) 在此处输入图像描述 将“data-store-api”替换为嵌套js项目名称

If you don't want to use the nx console in VSCode, you can also run the command nx g @nrwl/nest:controller <controller-name> -p <project-name> . Check out the docs on the @nrwl/nest generators and their options

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM