aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/index.ts12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/index.ts b/src/index.ts
index a546f13..c934530 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -1,13 +1,17 @@
-import { Hono } from "hono";
import { serve } from "@hono/node-server";
import { serveStatic } from "@hono/node-server/serve-static";
import { Eta } from "eta";
-import { getGitHubTree, getGitHubBlob } from "./scraper.js";
+import { Hono } from "hono";
+import * as path from "node:path";
+import * as url from "node:url";
+import { getGitHubBlob, getGitHubTree } from "./scraper.js";
+
+const __dirname = path.dirname(url.fileURLToPath(import.meta.url));
const app = new Hono();
-const eta = new Eta({ views: "./views" });
+const eta = new Eta({ views: path.join(__dirname, "..", "views") });
-app.use("/static/*", serveStatic({ root: "." }));
+app.use("/static/*", serveStatic({ root: path.join(__dirname, "..") }));
app.get("/:owner/:repo/tree/:branch/:path{.*}?", async (c) => {
try {