我全局安装了http-server,但仍然无法加载我的angular应用程序。我可以从执行http-server C:\Users\Alex\Desktop\angularjsTDD\app开始,但是当我访问localhost:8080时,终端显示未找到错误消息。我的应用程序的结构可以在githib中找到
https://github.com/eldyvoon/angularTDD
之前我使用express作为后端,但我想尝试使用更简单的东西,但无法使其工作。
如果我不使用file:///C:/Users/Alex/Desktop/angularjs%20TDD/app/index.html这样的http-server来访问index.html,我会在chrome中得到Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https, chrome-extension-resource.错误。
发布于 2016-12-18 23:36:40
如果您正在尝试提供静态文件,我认为您需要在提供服务的目录中放置一个名为public的文件夹。Soi在您的结构中,创建一个名为public的文件夹,并将所有文件放入其中。然后,服务应用程序应从公共文件夹加载index.html。
发布于 2016-12-18 23:42:30
我使用了一些启动http-server的路径,这是错误的。
我已经找到解决方案了。正确的解决方法是
cd到我的项目中,运行http-server。
https://stackoverflow.com/questions/41209579
复制相似问题