From e2db34a6b28449bec95240184ff467d4910d640a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=87=E5=A4=A9?= Date: Tue, 26 Apr 2022 01:46:30 +0800 Subject: [PATCH] patch index.html --- index.js | 4 ++++ package.json | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 666f08f..8c14966 100644 --- a/index.js +++ b/index.js @@ -74,6 +74,10 @@ function createServer() { pathname = decode(pathname) || 'index.html' + if (pathname.endsWith('/')) { + pathname += 'index.html' + } + let file = join(root, pathname) let stat = fs.stat(file) let ext = pathname.split('.').pop() diff --git a/package.json b/package.json index 1916869..a9dfc41 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "simple-http", "displayName": "simple http", "description": "🔥 简单的http服务器, 方便临时调试html", - "version": "1.2.1", + "version": "1.2.2", "publisher": "yutent", "author": "Yutent [@yutent]", "icon": "logo.png",