blackwolfhk / Practice-NestJS-API

A general practice of using Nest.js

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

<<<<<<< HEAD

Nest Logo

A progressive Node.js framework for building efficient and scalable server-side applications.

NPM Version Package License NPM Downloads CircleCI Coverage Discord Backers on Open Collective Sponsors on Open Collective Support us

Description

Nest framework TypeScript starter repository.

Installation

$ npm install

Running the app

# development
$ npm run start

# watch mode
$ npm run start:dev

# production mode
$ npm run start:prod

Test

# unit tests
$ npm run test

# e2e tests
$ npm run test:e2e

# test coverage
$ npm run test:cov

Support

Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please read more here.

Stay in touch

License

Nest is MIT licensed.

Practice-NestJS

A general practice of using Nest.js

Install the Nest.js command-line interface (CLI) globally on your system

npm install -g @nestjs/cli

Run the following command to create a new Nest.js project

nest new <>

Create a new module with the specified name and generate the necessary files and code structure for the module (Make sure you are in the root directory of your Nest.js project.)

nest generate module <>

To generate a controller file with a specific name and directory structure in a Nest.js project using the Nest.js CLI

nest generate controller messages/messages --flat

  • nest generate controller: This part of the command tells the Nest.js CLI to generate a controller.

  • messages/messages: This specifies the name and directory structure for the generated controller. In this case, it creates a controller named "messages" within a directory named "messages" (nested controller).

  • --flat: The --flat option is used to generate the controller file directly in the src/ directory, without creating a subdirectory for it. It ensures that the generated controller file is placed at the root level of the src/ directory.

The command is useful in scenarios where you want to create a controller with a specific name and directory structure. It allows you to organize your controllers in a hierarchical manner by creating subdirectories for different sections or features of your application.

main

About

A general practice of using Nest.js


Languages

Language:TypeScript 89.5%Language:JavaScript 6.7%Language:HTML 2.5%Language:CSS 1.3%