[英]How to run express and angular in parallel with nx?
I'm new to nx and I want to create node express application with angular application.我是 nx 的新手,我想使用 angular 应用程序创建节点快速应用程序。
So I ran those commands:所以我运行了这些命令:
npx create-nx-workspace // empty, nx. myorg-repo
cd myorg-repo
npm install --save-dev @nrwl/angular
npm install --save-dev @nrwl/express
nx g @nrwl/express:app express-app
nx g @nrwl/angular:app ng-app
Now when I run npm run start
or npm run build
it only run one project.现在,当我运行npm run start
或npm run build
时,它只运行一个项目。
My question is how to run start (serve)
command in parallel with nx?我的问题是如何与 nx 并行运行start (serve)
命令?
nx run-many --parallel --target=serve --projects=project1,project2,project3
More info on running commands in parallel with nx => https://nx.dev/previous/angular/cli/run-many有关与 nx 并行运行命令的更多信息 => https://nx.dev/previous/angular/cli/run-many
You can also open two separate terminals or as many as you want and can start one project from each.您还可以打开两个单独的终端或任意数量的终端,并且可以从每个终端启动一个项目。
terminal 1
nx serve ng-app
terminal 2nx serve express-app
终端 1nx serve ng-app
终端 2nx serve express-app
Boom your servers will get started on two ports and as the proxy is already configured by nx CLI while creating a new project you just have to call your API like /API/20percentDone
Boom 您的服务器将在两个端口上启动,并且由于 nx CLI 已经配置了代理,因此在创建新项目时您只需调用 API 就像/API/20percentDone
20percentDone
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.