Skip to content

Commit 46cf834

Browse files
committed
chore: make it easier to specify other port
When port 8000 is already in use, make it easier for users of the tutorial to change it to an different port
1 parent 3ff7cc9 commit 46cf834

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

docs/tutorial/basics.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ project directory and write the following code:
160160
::: code-group
161161

162162
~~~~ typescript twoslash [Deno]
163-
Deno.serve(request =>
163+
Deno.serve({ port: 8000 }, request =>
164164
new Response("Hello, world", {
165165
headers: { "Content-Type": "text/plain" }
166166
})
@@ -272,6 +272,7 @@ import type { Federation } from "@fedify/fedify";
272272
const federation = null as unknown as Federation<void>;
273273
// ---cut-before---
274274
Deno.serve(
275+
{ port: 8000 },
275276
request => federation.fetch(request, { contextData: undefined })
276277
);
277278
~~~~
@@ -402,6 +403,7 @@ federation.setActorDispatcher("/users/{identifier}", async (ctx, identifier) =>
402403
});
403404
404405
Deno.serve(
406+
{ port: 8000 },
405407
request => federation.fetch(request, { contextData: undefined })
406408
);
407409
~~~~
@@ -649,6 +651,7 @@ const federation = null as unknown as Federation<void>;
649651
import { behindProxy } from "@hongminhee/x-forwarded-fetch";
650652
651653
Deno.serve(
654+
{ port: 8000 },
652655
behindProxy(request => federation.fetch(request, { contextData: undefined }))
653656
);
654657
~~~~
@@ -1179,7 +1182,9 @@ import type { Federation } from "@fedify/fedify";
11791182
const federation = null as unknown as Federation<void>;
11801183
const kv = await Deno.openKv();
11811184
// ---cut-before---
1182-
Deno.serve(async (request) => {
1185+
Deno.serve(
1186+
{ port: 8000 },
1187+
async (request) => {
11831188
const url = new URL(request.url);
11841189
// The home page:
11851190
if (url.pathname === "/") {

0 commit comments

Comments
 (0)