Skip to content

Commit d2c2842

Browse files
committed
docs: clarify first project run steps
Add a `cd my_project` step before running the program, briefly note that Deno infers the `run` subcommand from a file path, and rephrase the `main.ts` description so it isn't pinned to a specific Deno version.
1 parent 2ca25d2 commit d2c2842

1 file changed

Lines changed: 15 additions & 6 deletions

File tree

runtime/getting_started/first_project.md

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,22 +35,31 @@ my_project
3535

3636
A `deno.json` file is created to
3737
[configure your project](/runtime/fundamentals/configuration/), and two
38-
TypeScript files are created; `main.ts` and `main_test.ts`. As of Deno 2.8 the
39-
`main.ts` file contains a small HTTP server built on
40-
[`Deno.serve`](/api/deno/~/Deno.serve)it shows off Deno's built-in HTTP
41-
server, `Response.json()`, and TypeScript working out of the box. The handler is
42-
exported and guarded by `import.meta.main`, so `main_test.ts` can import and
43-
call it directly without binding to a port.
38+
TypeScript files are created; `main.ts` and `main_test.ts`. The `main.ts` file
39+
contains a small HTTP server built on [`Deno.serve`](/api/deno/~/Deno.serve)
40+
it shows off Deno's built-in HTTP server, `Response.json()`, and TypeScript
41+
working out of the box. The handler is exported and guarded by
42+
`import.meta.main`, so `main_test.ts` can import and call it directly without
43+
binding to a port.
4444

4545
## Run your project
4646

47+
Move into the new project directory:
48+
49+
```bash
50+
cd my_project
51+
```
52+
4753
You can run this program with the following command:
4854

4955
```bash
5056
$ deno main.ts
5157
Listening on http://localhost:8000/
5258
```
5359

60+
When you pass a file path directly, Deno infers the `run` subcommand, so
61+
`deno main.ts` is equivalent to `deno run main.ts`.
62+
5463
Open the URL in your browser to see the response.
5564

5665
## Run your tests

0 commit comments

Comments
 (0)