[英]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.我正在使用 NX 工作区的 angular-nest 样板来开始使用应用程序。 Whenever I try to use the CLI or the NX extension to generate a controller/module etc, it gets placed in the wrong folder.
每当我尝试使用 CLI 或 NX 扩展来生成控制器/模块等时,它都会被放置在错误的文件夹中。
https://i.imgur.com/MbOhdgU.png 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.例如,如果我为嵌套生成一个新模块,我希望将它放在
api/src
中,因为那是嵌套文件所在的位置。 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.但在我的情况下,如果我使用命令
nest generate module helloworld
,它将被放置在api/src
文件夹之外的src/helloworld
文件夹中。
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?有没有更简单的方法可以让我的 Nest 组件和模块等在 Nest 文件夹中生成,Angular 组件等在 Angular 文件夹中?
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>
.如果不想在 VSCode 中使用 nx 控制台,也可以运行命令
nx g @nrwl/nest:controller <controller-name> -p <project-name>
。 Check out the docs on the @nrwl/nest
generators and their options查看
@nrwl/nest
生成器及其选项的文档
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.