server from moderate
后台通过nodejs中的fs模块读取指定文件夹下的md文件,并格式化成字符串传给前端,
const chokidar = require("chokidar");
const watcher = chokidar.watch(docsDir.path, {
ignored: /[\/\\]\./,
ignoreInitial: process.env.initDoc !== "true",
});
watcher
.on("add", function (path) {
console.log("File", path, "has been added");
})
.on("unlink", function (path) {
console.log("File", path, "has been delete");
});