last fixes hopefully

This commit is contained in:
TopchetoEU 2023-07-01 02:00:59 +03:00
parent 0dbfd14313
commit 1d3b31532a
3 changed files with 4 additions and 5 deletions

View File

@ -23,7 +23,7 @@ if (Deno.args[0] === "prod") {
if (!r) req.respondWith(new Response("nope :/", { if (!r) req.respondWith(new Response("nope :/", {
status: 404 status: 404
})); }));
else req.respondWith(r.toFetchResponse()); else await req.respondWith(r.toFetchResponse());
} }
})().catch(console.error); })().catch(console.error);
} }

View File

@ -107,7 +107,6 @@ export default class Router {
for await (const conn of server) { for await (const conn of server) {
(async () => { (async () => {
for await (const req of Deno.serveHttp(conn)) { for await (const req of Deno.serveHttp(conn)) {
console.log(req.request.url);
const r = await this.handle(RestRequest.fromMessage(req)); const r = await this.handle(RestRequest.fromMessage(req));
if (r) req.respondWith(r.toFetchResponse()); if (r) req.respondWith(r.toFetchResponse());
} }

View File

@ -12,11 +12,11 @@ export default function staticHandler(path: string): Handler {
await stream.read(new Uint8Array(1)); await stream.read(new Uint8Array(1));
await stream.seek(0, Deno.SeekMode.Start); await stream.seek(0, Deno.SeekMode.Start);
if (i >= 0) res.contentType(realPath.substring(i + 1)); if (i >= 0) return res.contentType(realPath.substring(i + 1));
return res; else return res;
} }
catch (e) { catch (e) {
console.log(e); console.error(e);
return undefined; return undefined;
} }
} }