fix: use await Deno.serve().finished (#1287)

[A recent change in the
runtime](https://github.com/denoland/deno/pull/19485) has changed the
behaviour of `Deno.serve()` such that it throws when called a promise.
The correct way to do it is instead to call `Deno.serve().finished` as a
promise. This PR does that.

Fixes
https://github.com/denoland/fresh/pull/1286#issuecomment-1589987387
This commit is contained in:
Asher Gomez
2023-06-14 08:23:51 +10:00
committed by GitHub
parent 47c7f4ec9a
commit 5ef6fa34d9
+1 -1
View File
@@ -128,7 +128,7 @@ export async function start(routes: Manifest, opts: StartOptions = {}) {
async function bootServer(handler: ServeHandler, opts: StartOptions) {
if (opts.experimentalDenoServe === true) {
// @ts-ignore as `Deno.serve` is still unstable.
await Deno.serve({ ...opts, handler });
await Deno.serve({ ...opts, handler }).finished;
} else {
await serve(handler, opts);
}