serve from file instead of object
This commit is contained in:
parent
ea72b74447
commit
998d8b3b31
|
|
@ -194,6 +194,7 @@ export const createServer = async () => {
|
||||||
if (core[pathname]) content = core[pathname];
|
if (core[pathname]) content = core[pathname];
|
||||||
else if (site[pathname]) content = site[pathname];
|
else if (site[pathname]) content = site[pathname];
|
||||||
else if (pub[pathname]) {
|
else if (pub[pathname]) {
|
||||||
|
console.log(`[DEBUG] Serving file from public folder: ${pathname}`);
|
||||||
// Serve file directly from public folder
|
// Serve file directly from public folder
|
||||||
const filePath = dir(`public/${pathname}`);
|
const filePath = dir(`public/${pathname}`);
|
||||||
const file = Bun.file(filePath);
|
const file = Bun.file(filePath);
|
||||||
|
|
@ -230,6 +231,7 @@ export const createServer = async () => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log(`[DEBUG] Serving file: ${pathname} with content type: ${opt?.headers?.get("Content-Type") || "unknown"}`);
|
||||||
// Return the file directly (Bun will stream it efficiently)
|
// Return the file directly (Bun will stream it efficiently)
|
||||||
return new Response(file, {
|
return new Response(file, {
|
||||||
status: 200,
|
status: 200,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue