Skip to content

Commit

Permalink
Merge pull request #2852 from jtimmons/docs/clarify-hybrid-app-startup
Browse files Browse the repository at this point in the history
docs(microservices): clarify hybrid application startup
  • Loading branch information
kamilmysliwiec authored Sep 11, 2023
2 parents d128889 + d8160f3 commit ee6360c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion content/faq/hybrid-application.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
### Hybrid application

A hybrid application is one that both listens for HTTP requests, as well as makes use of connected microservices. The `INestApplication` instance can be connected with `INestMicroservice` instances through the `connectMicroservice()` method.
A hybrid application is one that listens for requests from two or more different sources. This can combine an HTTP server with a microservice listener or even just multiple different microservice listeners. The default `createMicroservice` method does not allow for multiple servers so in this case each microservice must be created and started manually. In order to do this, the `INestApplication` instance can be connected with `INestMicroservice` instances through the `connectMicroservice()` method.

```typescript
const app = await NestFactory.create(AppModule);
Expand All @@ -12,6 +12,8 @@ await app.startAllMicroservices();
await app.listen(3001);
```

> info **Hint** the `app.listen(port)` method starts an HTTP server on the specified address. If your application does not handle HTTP requests then you should use the `app.init()` method instead.
To connect multiple microservice instances, issue the call to `connectMicroservice()` for each microservice:

```typescript
Expand Down

0 comments on commit ee6360c

Please sign in to comment.