feat(server): Add basePath config to host from a directory (#2092)
Co-authored-by: Marvin Hagemeister <marvin@deno.com>
This commit is contained in:
co-authored by
Marvin Hagemeister
parent
fe792455ab
commit
9ab8651018
@@ -371,3 +371,10 @@ export function router<T = unknown>(
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
export function withBase(src: string, base?: string) {
|
||||
if (base !== undefined && src.startsWith("/") && !src.startsWith(base)) {
|
||||
return base + src;
|
||||
}
|
||||
return src;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user