简体   繁体   中英

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.

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.

My question is how to run start (serve) command in parallel with nx?

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

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 2 nx 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

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