运行Angular Cli Ng服务于https 2018 [英] Run Angular Cli Ng Serve over https 2018

查看:81
本文介绍了运行Angular Cli Ng服务于https 2018的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有一种方法可以通过https运行我的有角度的本地主机???我尝试了一些不同的教程,但Ive尝试了没有任何效果..

Is there a way I can run my angular localhost over https?? I have tried a few different tutorials but nothing has worked Ive tried.. serve your angular cli app over https but it would still serve over http:// has anyone succesfully done this? If so can you point me in the right direction?

谢谢

推荐答案

另一种选择,如果您没有证书,并且想要使用自签名进行测试,只需将标志"start": "ng serve --ssl",添加到package.json,在投放应用程序时会生成一个.

Another option, if you don't have a certificate and want to use a self-signed for testing purposes, just to add the flag "start": "ng serve --ssl", to the package.json, it will generate one when serving the app.

Angular CLI: 7.3.1
Node: 8.11.3
OS: win32 x64
Angular: 7.2.5

命令:

npm start

输出:

> ng serve --ssl
** Angular Live Development Server is listening on localhost:4200, 
open your browser on https://localhost:4200/ 
     10% building 4/4 modules 0 activei 「wds」: Generating SSL Certificate

这篇关于运行Angular Cli Ng服务于https 2018的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆