NodeJS: How to Create New Project and Module

Here is a simple guide on how to create new project and module in NodeJS.

 

1. Create a new project

nest new project name

2. Create a service file (user has been used as an example)

Syntax: nest g [file type] [file name] [file directory (under src directory)]
For example: nest g service user (create user folder under src) logical
You can also write: nest g service user (also create a user under src)
The user folder contains the user.service.ts file

3. Create a Controller (user has been used as an example)

nest g controller user logical (logical can not be written)

4. Create a Module (user has been used as an example)

nest g module user logical

Similar Posts:

Leave a Reply

Your email address will not be published. Required fields are marked *