From 8199f16d10596810236e5944aae1b2a05fa3e687 Mon Sep 17 00:00:00 2001 From: James Feng Cao Date: Sun, 17 Mar 2024 13:42:27 +0800 Subject: [PATCH] fix deno.js to deploy static site --- js/deno.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/js/deno.js b/js/deno.js index 0436fa6..33a3490 100644 --- a/js/deno.js +++ b/js/deno.js @@ -2,10 +2,10 @@ import { serveFile } from "https://deno.land/std/http/file_server.ts"; async function handler(req){ let url = req.url; let iSlash = url.indexOf('/',11); - let path = url.substring(iSlash+1); + let path = url.substring(iSlash); if(path.endsWith('/')) path = path + 'index.html'; - return await serveFile(req, `${Deno.cwd()}/`+path); + return await serveFile(req, `${Deno.cwd()}`+path); }; Deno.serve(handler);