add listening info on start

This commit is contained in:
HorizonCode 2023-05-10 15:00:17 +02:00
parent c6c739394f
commit 469a83c8e7

View File

@ -30,6 +30,12 @@ export class HTTPServer {
hostname: options.host,
});
console.log(
`Listening on ${
options.host ? options.host : "http://localhost"
}:${options.port} !`,
);
if (options.staticLocalDir && options.staticServePath) {
this.staticLocalDir = options.staticLocalDir;
this.staticServePath = options.staticServePath;
@ -42,14 +48,12 @@ export class HTTPServer {
const filepath = decodeURIComponent(url.pathname);
if (this.staticServePath && filepath.startsWith(this.staticServePath)) {
console.log(filepath, this.staticServePath);
const fileDir = filepath.split("/").slice(2).join("/");
const pathLoc = path.join(
Deno.cwd(),
this.staticLocalDir as string,
fileDir,
);
console.log(pathLoc);
let file;
try {
file = await Deno.open(pathLoc, { read: true });