简体   繁体   中英

How to run node.js and angular2+ at the same time

I have node.js project with Angular4CLI in folder "UI"

node.js package.json:

 ... "scripts": { "start": "node index.js" } ... 

and Angular package.json:

 ... "scripts": { "ng": "ng", "start": "ng serve", "build": "ng build", "test": "ng test", "lint": "ng lint", "e2e": "ng e2e" } ... 

How to start node.js and angular at the same time?

I've tried wrong solutions:

 "scripts": { "start": "node index.js && ng serve", "start-2": "node index.js && cd .\\ui\\ && ng serve", } 

Please help. thanks advance

I would recommend looking into angular universal.

https://github.com/angular/universal-starter

The documentation makes usage clear, and there a few decent seed repositories out there too.

Look for qdoubles material pre-rendering webpack-starter, it is really straight forward to merge an existing application into this starter too.

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