如何在端口8080上的C9.io上为TypeScript运行Angular.JS 2? [英] How do I run Angular.JS 2 for TypeScript on C9.io on port 8080?
问题描述
我遵循了这个快速教程: https://angular.io/guide/quickstart 并在C9.io上构建代码,但是通过默认情况下,它试图在端口3000上运行,而C9.io仅允许使用端口8080、8081和8082.那么如何在C9.io上运行它?
I followed this quick tutorial: https://angular.io/guide/quickstart and build the code on C9.io, but by default it's trying to run on port 3000, and C9.io only allows using ports 8080, 8081, and 8082. So how can I run it on C9.io?
这是我的代码: https://ide.c9.io/mathieu_roy/angular2-quickstart
推荐答案
我正在处理同一问题,而不是创建可以自动发现的bs-config.json,您可以创建一个bs-config.js来默认情况下也可以发现并使用.将bs-config.js文件放在根目录中.
I was dealing with the same issue, instead of creating a bs-config.json which will be discoverable automatically you can create a bs-config.js which will also be discoverable by default and be used. Place the bs-config.js file in the root directory.
//bs-config.js
module.exports = {
port: process.env.PORT,
files: [ './**/*.{html,htm,css,js}' ],
server: {
baseDir: "./"
}
};
现在您可以使用c9环境变量,例如process.env.PORT
now you can use c9 environment variables like process.env.PORT
这篇关于如何在端口8080上的C9.io上为TypeScript运行Angular.JS 2?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!