在 http 服务器中启用目录列表
Enable directory listing in http-server
我刚刚通过以下方式安装了 http-server
:
npm install --global http-server
我想设置一个服务器来显示我的目录列表以用于测试和学习目的。我已经尝试过:
-d
Show directory listings (defaults to true
)
-i
Display autoIndex (defaults to true
)
但是在创建服务器后它总是打开 index.html 而不是目录列表。
这或多或少是我想要得到的,而不是打开 index.html:
我想达到的目标:
这应该可以正常工作
npm install http-server -g
cd Directory/
http-server
如果您不想使用 Http-server,请遵循此 answer
-i
Display autoIndex (defaults to true
)
这就是 http-server
显示索引的原因(默认启用),您可以像这样关闭它:
http-server -i false
我刚刚通过以下方式安装了 http-server
:
npm install --global http-server
我想设置一个服务器来显示我的目录列表以用于测试和学习目的。我已经尝试过:
-d
Show directory listings (defaults totrue
)
-i
Display autoIndex (defaults totrue
)
但是在创建服务器后它总是打开 index.html 而不是目录列表。
这或多或少是我想要得到的,而不是打开 index.html:
我想达到的目标:
这应该可以正常工作
npm install http-server -g
cd Directory/
http-server
如果您不想使用 Http-server,请遵循此 answer
-i
Display autoIndex (defaults totrue
)
这就是 http-server
显示索引的原因(默认启用),您可以像这样关闭它:
http-server -i false