Skip to content

Commit 6377ca3

Browse files
authored
docs: add HTTP server API section to Deploy migration guide (#3023)
1 parent 35a65f5 commit 6377ca3

1 file changed

Lines changed: 27 additions & 0 deletions

File tree

deploy/migration_guide.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,33 @@ See the
7171
[custom domain migration tutorial](/examples/migrate_custom_domain_tutorial/)
7272
for a step-by-step walkthrough.
7373

74+
## HTTP server API
75+
76+
Deploy Classic supported the `serve()` function from the `deno.land/std` HTTP
77+
module (e.g. `https://deno.land/std@0.170.0/http/server.ts`). The new Deploy
78+
does **not** support this legacy `serve()` function.
79+
80+
Update your code to use the built-in
81+
[`Deno.serve()`](https://docs.deno.com/api/deno/~/Deno.serve) API instead:
82+
83+
```diff
84+
- import { serve } from "https://deno.land/std@0.170.0/http/server.ts";
85+
-
86+
- serve(() => new Response("hello, world"));
87+
+ Deno.serve(() => new Response("hello, world"));
88+
```
89+
90+
`Deno.serve()` has been the recommended HTTP server API since Deno 1.35 and is
91+
more performant. If your application uses the old standard library `serve()`,
92+
update it before migrating to the new Deploy.
93+
94+
If you deploy code that uses the old `serve()` function to the new Deploy, it
95+
will fail with a **timeout error during the warmup phase** of deployment. If you
96+
encounter this error, check whether your entrypoint or any of your dependencies
97+
is using the standard library `serve()`. Some older versions of third-party
98+
libraries may internally depend on the legacy `serve()` function — in that case,
99+
upgrade the library to a version that uses `Deno.serve()` instead.
100+
74101
## Cron jobs
75102

76103
The `Deno.cron()` API works the same way on the new Deploy. Your existing cron

0 commit comments

Comments
 (0)