如何部署angular 2 cli应用程序

时间:2016-12-23 22:04:07

标签: angular angular-cli

我对如何托管应用感到困惑。我用cli制作了它。我只是把dist文件夹推送到我的托管服务(去爸爸)? 步骤是什么?我无法找到上传应用程序所需的步骤。

2 个答案:

答案 0 :(得分:6)

1- ng build --prod
2- Copy dist 
3- Upload to your web server
4- Point your webserver to dist/index.html

答案 1 :(得分:1)

npm install --global surge

#cd到dist文件夹,然后运行...

$ surge

Surge - surge.sh

email: youremail@gmail.com

token: ***************** 
(first time it will ask for password, make sure you have a account on surge.sh)

project path: I:\Code\myangular2app\dist\

size: 33 files, 11.0 MB

domain: auto-generated.surge.sh 
*(delete auto-generated name and put a unique one)*

upload: [====================] 100%, eta: 0.0s

propagate on CDN: [====================] 100%

plan: Free

users: youremail@gmail.com

IP Address: 45.55.110.124

Success! Project is published and running at unique-name.surge.sh