fix
This commit is contained in:
@@ -150,6 +150,8 @@ export const createServer = async () => {
|
||||
return api;
|
||||
}
|
||||
|
||||
console.log(`[DEBUG] No API found, lookup for ${url.pathname}`);
|
||||
|
||||
if (g.deploy.router) {
|
||||
const found = g.deploy.router.lookup(url.pathname);
|
||||
if (found) {
|
||||
@@ -161,10 +163,14 @@ export const createServer = async () => {
|
||||
});
|
||||
}
|
||||
|
||||
console.log(`[DEBUG] No route found, check content for ${url.pathname}`);
|
||||
|
||||
if (g.deploy.content) {
|
||||
const core = g.deploy.content.code.core;
|
||||
const site = g.deploy.content.code.site;
|
||||
const pub = g.deploy.content.public;
|
||||
//list all content
|
||||
// console.log(`[DEBUG] Content paths: core=${Object.keys(core).join(", ")}, site=${Object.keys(site).join(", ")}, pub=${Object.keys(pub).join(", ")}`);
|
||||
|
||||
let pathname = url.pathname;
|
||||
if (url.pathname[0] === "/") pathname = pathname.substring(1);
|
||||
@@ -188,6 +194,8 @@ export const createServer = async () => {
|
||||
else if (site[pathname]) content = site[pathname];
|
||||
else if (pub[pathname]) content = pub[pathname];
|
||||
|
||||
|
||||
|
||||
if (content) {
|
||||
return await serveWeb({
|
||||
content,
|
||||
|
||||
@@ -2,6 +2,7 @@ import { createResponse } from "service-srv";
|
||||
import { g } from "../utils/global";
|
||||
|
||||
export const serveAPI = async (url: URL, req: Request) => {
|
||||
console.log(`[DEBUG] serveAPI called with pathname: ${url.pathname}`);
|
||||
let found = g.router.lookup(url.pathname);
|
||||
if (!found?.url) {
|
||||
if (!url.pathname.endsWith("/")) {
|
||||
|
||||
Reference in New Issue
Block a user