【问题标题】:http-server : how to set the root directory of my server?http-server:如何设置我的服务器的根目录?
【发布时间】:2015-08-22 01:38:20
【问题描述】:

我通过节点的http-server module 运行服务器。麻烦的是,它显示了工作目录/document/js/

# /document/js/server.makefile
node ../node_modules/.bin/forever ../node_modules/.bin/http-server --cors &
# localhost:8080 shows content of /document/js/

我实际上希望我的服务器显示/document 的内容。

如何设置我的服务器的根文件夹(/document/js/server.makefile)让localhost:8080显示/document/的内容?

【问题讨论】:

    标签: node.js makefile httpserver


    【解决方案1】:

    http-server 文档usage 声明您可以在选项之前传入路径。因此,在您的情况下,您可能想尝试以下操作:

    hs /document [your_options]
    

    添加-o 以在启动服务器后打开浏览器。

    【讨论】:

      猜你喜欢
      • 2011-08-14
      • 1970-01-01
      • 1970-01-01
      • 2020-02-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-05-10
      • 1970-01-01
      相关资源
      最近更新 更多