Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update nestjs.md #1672

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 5 additions & 8 deletions docs/ts/how-to/nestjs.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ lang: ts
---

[Nest](https://docs.nestjs.com/) (NestJS) is a framework for building efficient, scalable TypeScript server-side
applications. Nest aims to provide
an application architecture out of the box which allows for effortless creation of highly testable, scalable, and
loosely coupled and easily maintainable applications.
applications. Nest provides an out-of-the-box application architecture for creating highly testable, scalable, loosely coupled, and maintainable applications.

Encore is not opinionated when it comes to application architecture, so you can use it together with NestJS to structure
your business logic and Encore for creating backend primitives like APIs, Databases, and Cron Jobs.
Expand All @@ -20,7 +18,7 @@ your business logic and Encore for creating backend primitives like APIs, Databa

## Adding Encore to a NestJS project

In you already have a NestJS project, you can add Encore to it by following these steps:
If you already have a NestJS project, you can add Encore to it by following these steps:

1. Run `encore app init` in the root of your project to create a new Encore application.
2. Add `encore.dev` as a dependency by running `npm install encore.dev`.
Expand All @@ -41,8 +39,7 @@ In you already have a NestJS project, you can add Encore to it by following thes

## Standalone Nest application

In order for Encore to be able to provision infrastructure resources, generate API documentation etc. we need to run our
application using Encore. This means that we need to replace the ordinary Nest bootstrapping and instead run our Nest
To enable Encore to provision infrastructure resources and generate API documentation, we need to run the application using Encore. This means that we need to replace the ordinary Nest bootstrapping and instead run our Nest
app as
a [standalone application](https://docs.nestjs.com/standalone-applications). We do this by
calling `NestFactory.createApplicationContext(AppModule)` and then selecting the modules/services we need:
Expand Down Expand Up @@ -161,7 +158,7 @@ above we have a `cats` service with three APIs because `cats.controller.ts` is p

## Making use of other Encore features

Encore also allows you to easily make use of other backend primitives in your Nest app,
Encore allows you to use other backend primitives in your Nest app,
like [Databases](/docs/ts/primitives/databases), [Cron Jobs](/docs/ts/primitives/cron-jobs), [Pub/Sub & Queues](/docs/ts/primitives/pubsub)
and [Secrets](/docs/ts/primitives/secrets).

Expand All @@ -176,7 +173,7 @@ After those steps we are ready to run our app locally:
$ encore run
```

You should see log messages about both Encore and Nest staring up. That means your local development environment is up
You should see log messages about both Encore and Nest starting up. That means your local development environment is up
and
running and ready to take some requests!

Expand Down