better
This commit is contained in:
6
main.ts
6
main.ts
@@ -2,7 +2,7 @@ import { serveFile } from "jsr:@std/http/file-server";
|
||||
import { createSSRApp } from "vue";
|
||||
import { renderToString } from "vue/server-renderer";
|
||||
import App from "@/App.tsx";
|
||||
import transpileResponse from './transpileTs.ts';
|
||||
import transpileResponse from './transpile.ts';
|
||||
|
||||
const utf8Decoder = new TextDecoder("utf-8");
|
||||
|
||||
@@ -17,7 +17,7 @@ Deno.serve({
|
||||
const pathname = URL.parse(req.url)?.pathname ?? "/";
|
||||
if (pathname === "/") {
|
||||
const rendered = await renderToString(createSSRApp(App));
|
||||
const content = utf8Decoder.decode(await Deno.readFile("./playground/index.html"))
|
||||
const content = utf8Decoder.decode(await Deno.readFile("./public/index.html"))
|
||||
.replace(`<!-- SSR OUTLET -->`, rendered)
|
||||
.replace(`<!-- SSR HEAD OUTLET -->`, '');
|
||||
return new Response(content, { headers: { "Content-Type": "text/html" } });
|
||||
@@ -29,7 +29,7 @@ Deno.serve({
|
||||
} else if (pathname.startsWith('/deps')) {
|
||||
return serveFile(req, `node_modules/${pathname.split('/deps')[1]}`);
|
||||
} else {
|
||||
return serveFile(req, `playground${pathname}`);
|
||||
return serveFile(req, `public${ pathname }`);
|
||||
}
|
||||
} else {
|
||||
return new Response("Only GET allowed.", { status: 500 });
|
||||
|
||||
Reference in New Issue
Block a user