Skip to content

Commit 424bfc2

Browse files
committed
update:支持vercel部署
1 parent 4181f96 commit 424bfc2

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Diff for: controllers/root.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export default (fastify, options, done) => {
77
fastify.get('/', async (request, reply) => {
88
let readmePath = null;
99
const files = readdirSync(options.rootDir);
10-
console.log(files);
10+
// console.log(files);
1111
for (const file of files) {
1212
if (/^readme\.md$/i.test(file)) {
1313
readmePath = path.join(options.rootDir, file);
@@ -17,7 +17,8 @@ export default (fastify, options, done) => {
1717

1818
// 如果未找到 README.md 文件
1919
if (!readmePath) {
20-
reply.code(404).send('<h1>README.md not found</h1>');
20+
let fileHtml = files.map(file => `<li>${file}</li>`).join('');
21+
reply.code(404).type('text/html;charset=utf-8').send(`<h1>README.md not found</h1><ul>${fileHtml}</ul>`);
2122
return;
2223
}
2324

0 commit comments

Comments
 (0)