serve .ts too

This commit is contained in:
Chris Wanstrath 2025-09-27 19:01:30 -07:00
parent c2f0e0a990
commit a8102a2730

View File

@ -42,8 +42,8 @@ app.use("*", async (c, next) => {
app.on("GET", ["/js/:path{.+}", "/shared/:path{.+}"], async c => { app.on("GET", ["/js/:path{.+}", "/shared/:path{.+}"], async c => {
const path = "./src/" + c.req.path.replace("..", ".") const path = "./src/" + c.req.path.replace("..", ".")
// path must end in .js // path must end in .js or .ts
if (!path.endsWith(".js")) return c.text("File not found", 404) if (!path.endsWith(".js") && !path.endsWith(".ts")) return c.text("File not found", 404)
const ts = path.replace(".js", ".ts") const ts = path.replace(".js", ".ts")
if (isFile(ts)) { if (isFile(ts)) {