Compare commits

...

2 Commits

Author SHA1 Message Date
Colin McDonnell
74b2343708 Update guide 2023-08-09 13:56:30 -07:00
Colin McDonnell
39aa9d278f Add Nest.js guide 2023-08-09 13:49:23 -07:00

View File

@@ -0,0 +1,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.