All quizzesEasy
NestJS Basics
Preview — 3 of 10 questions
At its core, what kind of tool is NestJS?
javascript
import { NestFactory } from '@nestjs/core';
import { AppModule } from './app.module';
// Nest wraps a Node HTTP platform (Express by default)
async function bootstrap(): Promise<void> {
const app = await NestFactory.create(AppModule);
await app.listen(3000);
}
bootstrap();AA standalone HTTP server written in Rust that replaces Node.js
BA progressive Node.js framework for building server-side applications, by default running on top of Express
CA frontend UI library similar to React for building component trees
DA database ORM that generates SQL from TypeScript classes
What does NestFactory.create(AppModule) return?
javascript
import { NestFactory } from '@nestjs/core';
import { INestApplication } from '@nestjs/common';
import { AppModule } from './app.module';
const app: INestApplication = await NestFactory.create(AppModule);
await app.listen(3000);AA plain Express app instance with no Nest features
BA Promise resolving to a Nest application instance bootstrapped from the root module
CThe root module class itself, uninstantiated
DA synchronous object you can use immediately without awaiting
What is the conventional role of the bootstrap() function in main.ts?
javascript
async function bootstrap(): Promise<void> {
const app = await NestFactory.create(AppModule);
await app.listen(3000);
}
bootstrap(); // you must invoke it explicitlyAIt is the application entry point that creates and starts the Nest application
BIt defines the database schema for the whole app
CIt is automatically called by the @Module decorator
DIt is a lifecycle hook that runs before every HTTP request
Sign up free to play
Answer all 10 questions (7 more), see explanations for every answer, and track your score.