aboutsummaryrefslogtreecommitdiff
path: root/docs/guides/ecosystem/nestjs.md
blob: f66b92439dbb1d5b6d844d97f2b6889c47737525 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
---
name: Build a fullstack app with Nest.js and Bun
---

{% callout %}
Requires Bun `v0.7.0` or later.
{% /callout %}

---

Initialize your app with the Nest.js CLI.

```sh
$ bunx @nestjs/cli new my-app
⚡  We will scaffold your app in a few seconds..

? Which package manager would you ❤️  to use? bun
CREATE my-app/.eslintrc.js (663 bytes)
CREATE my-app/.prettierrc (51 bytes)
CREATE my-app/README.md (3347 bytes)
CREATE my-app/nest-cli.json (171 bytes)
CREATE my-app/package.json (1947 bytes)
CREATE my-app/tsconfig.build.json (97 bytes)
CREATE my-app/tsconfig.json (546 bytes)
CREATE my-app/src/app.controller.spec.ts (617 bytes)
CREATE my-app/src/app.controller.ts (274 bytes)
CREATE my-app/src/app.module.ts (249 bytes)
CREATE my-app/src/app.service.ts (142 bytes)
CREATE my-app/src/main.ts (208 bytes)
CREATE my-app/test/app.e2e-spec.ts (630 bytes)
CREATE my-app/test/jest-e2e.json (183 bytes)

✔ Installation in progress... ☕

🚀  Successfully created project my-app
👉  Get started with the following commands:

  $ cd my-app
  $ bun run start
```

---

As the Nest.js templater intructed, let's `cd` into our app directory and start the development server.

```sh
$ cd my-app
$ bun run start
 $ nest start
  [Nest] 35114  - 08/09/2023, 1:51:29 PM     LOG [NestFactory] Starting Nest application...
  [Nest] 35114  - 08/09/2023, 1:51:29 PM     LOG [InstanceLoader] AppModule dependencies initialized +5ms
  [Nest] 35114  - 08/09/2023, 1:51:29 PM     LOG [RoutesResolver] AppController {/}: +7ms
  [Nest] 35114  - 08/09/2023, 1:51:29 PM     LOG [RouterExplorer] Mapped {/, GET} route +0ms
  [Nest] 35114  - 08/09/2023, 1:51:29 PM     LOG [NestApplication] Nest application successfully started +1ms
```

---

To run the server in watch mode. Nest.js does not support hot reloading [out of the box](https://docs.nestjs.com/recipes/hot-reload), but you can run the server in watch mode. This will restart the server when changes are made.

```sh
$ bun run start:dev
```

---

Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.