Search⌘ K
AI Features

Create a New App Using NestJS CLI

Explore how to create a new NestJS project using the NestJS CLI and understand how to enable cross-origin resource sharing (CORS) to securely handle requests from different domains. Gain hands-on experience by generating the app, reviewing its structure, and testing the server with a sample endpoint.

Start the new NestJS project

In this lesson, we’ll create a new NestJS application and learn how to enable cross-domain resource sharing. We’ll use the online terminal to create our project, ensuring we gain hands-on experience in real time.

Generate a new application

The following command is used to generate a new NestJS project:

nest new address-book-api
Generate a new app using NestJS CLI

Click to connect to the terminal below and enter the above command into the terminal.

Terminal 1
Terminal
Loading...

We will be prompted to select the package manager (npm or Yarn). npm is a package manager for JavaScript and NodeJS applications that download and manage software packages. Choose npm and press “Enter.” After the package manager is chosen, the CLI will install all the necessary dependencies and create a new address-book-api directory ...