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
+3
-2
@@ -3,7 +3,7 @@ import { ServeHandler } from "./types.ts";
|
||||
|
||||
export async function startServer(
|
||||
handler: Deno.ServeHandler,
|
||||
opts: Partial<Deno.ServeTlsOptions>,
|
||||
opts: Partial<Deno.ServeTlsOptions> & { basePath: string },
|
||||
) {
|
||||
if (!opts.onListen) {
|
||||
opts.onListen = (params) => {
|
||||
@@ -12,7 +12,8 @@ export async function startServer(
|
||||
colors.bgRgb8(colors.rgb8(" 🍋 Fresh ready ", 0), 121),
|
||||
);
|
||||
|
||||
const address = colors.cyan(`http://localhost:${params.port}/`);
|
||||
const pathname = opts.basePath + "/";
|
||||
const address = colors.cyan(`http://localhost:${params.port}${pathname}`);
|
||||
const localLabel = colors.bold("Local:");
|
||||
console.log(` ${localLabel} ${address}\n`);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user