Bootstrapping
Every Nest.js application needs to be bootstrapped. This is done by by using the NestFactory
to create the root module and calling the listen()
method.
In our example application, the entry point is main.ts
and we use the async / await pattern to create the AppModule
and call listen()
:
import
{
NestFactory
}
from
'@nestjs/core'
;
import
{
AppModule
}
from
'./app.module'
;
async
function
bootstrap() {
const
app
=
await
NestFactory
.
create
(
AppModule
);
await
app
.
listen
(
3000
);
}
bootstrap
();