【问题标题】:How do you serve a directory listing from restify?您如何提供来自 restify 的目录列表?
【发布时间】:2016-11-04 22:12:09
【问题描述】:

如何让 Restify 提供目录列表服务?似乎可以提供目录的内容,但实际上不能列出它们。

【问题讨论】:

  • 您是否尝试将现有的index.html 重命名为某个名称(可能是index1.html)并查看它是否在列表中? (PS 我没试过)

标签: node.js express restify


【解决方案1】:

使用节点fs库,即fs.readdir

fs.readdir(path, function(err, items) { console. log(items); }

在资源端点内使用它来返回列表。

【讨论】:

    猜你喜欢
    • 2014-02-11
    • 1970-01-01
    • 1970-01-01
    • 2020-09-11
    • 2020-11-22
    • 2013-06-10
    • 2017-09-25
    • 1970-01-01
    • 2022-01-22
    相关资源
    最近更新 更多