我正在Angular 2中创建一个应用程序,它需要从服务器上运行的脚本中获取数据。为了做到这一点,我正在尝试将已经存在的Angular应用程序添加为快速应用程序的视图here。我按照教程中概述的说明进行了文件夹结构的初始设置,但教程没有讨论如何实际连接Angular和表达应用程序,以便在使用npm start
时它们一起运行。
然后我发现另一篇帖子建议使用我最终安装的express/angular generator生成这个package.json文件:
{
"name": "support-dashboard",
"version": "0.0.0",
"dependencies": {
"express": "~3.0.0",
"ejs": "~0.8.4"
},
"devDependencies": {
"connect-livereload": "~0.2.0",
"grunt": "~0.4.1",
"grunt-concurrent": "~0.3.0",
"grunt-contrib-clean": "~0.4.1",
"grunt-contrib-coffee": "~0.7.0",
"grunt-contrib-compass": "~0.3.0",
"grunt-contrib-concat": "~0.3.0",
"grunt-contrib-connect": "~0.3.0",
"grunt-contrib-copy": "~0.4.1",
"grunt-contrib-cssmin": "~0.6.0",
"grunt-contrib-htmlmin": "~0.1.3",
"grunt-contrib-imagemin": "~0.1.4",
"grunt-contrib-jshint": "~0.6.0",
"grunt-contrib-uglify": "~0.2.0",
"grunt-contrib-watch": "~0.4.0",
"grunt-google-cdn": "~0.2.0",
"grunt-karma": "~0.4.3",
"grunt-ngmin": "~0.0.2",
"grunt-open": "~0.2.0",
"grunt-rev": "~0.1.0",
"grunt-svgmin": "~0.2.0",
"grunt-usemin": "~0.1.11",
"jasmine-core": "^2.4.1",
"karma": "^1.1.2",
"karma-jasmine": "^1.0.2",
"karma-phantomjs-launcher": "^1.0.1",
"matchdep": "~0.1.2",
"phantomjs-prebuilt": "^2.1.11"
},
"engines": {
"node": ">=0.8.0"
},
"scripts": {
"test": "karma start test\\karma.conf.js"
}
}
尽管该程序包旨在为Express上的Angular提供设置,但此文件仅设置为express而不是Angular。 在Express中设置Angular 2项目的官方方法是什么?