Fix demo
parent
43b5f62210
commit
c80342417c
|
@ -1,5 +1,6 @@
|
||||||
const { resolve } = require("path");
|
const { resolve } = require("path");
|
||||||
const { readdir } = require("fs").promises;
|
const { readdir } = require("fs").promises;
|
||||||
|
const mime = require("mime-types");
|
||||||
|
|
||||||
async function getFiles(dir) {
|
async function getFiles(dir) {
|
||||||
const dirents = await readdir(dir, { withFileTypes: true });
|
const dirents = await readdir(dir, { withFileTypes: true });
|
||||||
|
@ -19,6 +20,8 @@ getFiles(rootDir).then((files) => {
|
||||||
.map((file) => ({
|
.map((file) => ({
|
||||||
name: file.substring(rootDir.length + 1),
|
name: file.substring(rootDir.length + 1),
|
||||||
lastModified: 0,
|
lastModified: 0,
|
||||||
|
contentType: mime.lookup(file),
|
||||||
|
size: 0,
|
||||||
perm: "rw",
|
perm: "rw",
|
||||||
}))
|
}))
|
||||||
.filter((pageMeta) => !pageMeta.name.startsWith("."));
|
.filter((pageMeta) => !pageMeta.name.startsWith("."));
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
/page /index.json 200
|
/fs /index.json 200
|
||||||
/page/* /empty.md 200
|
/fs/* /empty.md 200
|
||||||
/* /index.html 200
|
/* /index.html 200
|
Loading…
Reference in New Issue