Deb*_*nda 2 express nodemon mean-stack angular-cli angular
嗨,我正在开发一个使用角度4的平均应用程序.我使用了角度cli配置.我想使用监视模式自动构建代码,并且还希望在任何文件更改时重新启动节点服务器.
我使用了以下命令但没有工作
script: {
"server": "ng build -w && nodemon --watch src/**/*.ts --exec ts-node ./bin/www"
}
Run Code Online (Sandbox Code Playgroud)
我已将配置保存在从其他位置bin/www导入的目录文件中server.ts.
上面命令的问题是,ng cli正在构建启用了watch的代码,但nodemon没有启动.
所以我尝试了以下内容.但它的建筑只有一次作为手表没有启用cli.
script: {
"server": "ng build && nodemon --watch src/**/*.ts --exec ts-node ./bin/www"
}
Run Code Online (Sandbox Code Playgroud)
在任何一种情况下,nodemon都无法工作.
基于上面的评论,这就是我使2台服务器工作并响应任何变化的方式.
Run Code Online (Sandbox Code Playgroud){ "/api": { "target": "http://localhost:3000", "secure": false } }
Run Code Online (Sandbox Code Playgroud)"scripts": { "client": "ng serve --proxy-config server.conf.json", "server": "nodemon server.js", "start": "npm-run-all -p client server" }
现在ng服务正在观察Angular和nodemon中的任何变化- 在Node中.
localhost:4200 // ng serve => angular
localhost:4200/page // ng serve => angular
localhost:4200/another/page // ng serve => angular
localhost:4200/api // ng serve => node
localhost:4200/api/users // ng serve => node
localhost:3000/api // node
localhost:3000/api/users // node
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4744 次 |
| 最近记录: |