NodeJs Tutorials
- NodeJs
- Install NodeJs
- Why use NodeJs
- NodeJs Process Model
- create First Application
- Run NodeJs Application
- Node.js Console
- Node.Js Modules
- URL Modules
- node.js Callback
- Node.js Events
- Upload Files
- Upload single & Multiple Files
- NodeJs File System
- NodeJs Email
- Debugging NodeJs
- .ENV
- NodeJs Mysql
- Helpers
- encription and decription in nodeJs
- Query string
- Date & Time
- Express Js
- Template Engine with Express
- MVC Pattern in Node.Js
- list of NPM Module
- Middleware
- Body Parser
- Render
- Nodemon module
- Morgan module
- Flash Message in ExpressJs
- Session
- Session store in database
- Cookies
- Helmet
- Multer
- Router: How To Use Routing In Node.Js
- App.Js
- express.json() and express.urlencoded()
- REST APIs in NodeJs
- Gloabal Objects
- Submit Form Data
- How to get Post Data in Node.js
- How to Get URL Parameters in Node.js
- How to create Node Project
- How to Insert Form Data Into the MySql Table Using Node.js
- How to fetch Data from MySQL database table using Node.js
- CRUD Example
- Await and Async
- Promises
- Login Example
- Password Encription
- How to validate Form (Form Validation) in Node.Js?
- Registration & Login form usingn Node.Js & MySql?
- Forgot & Reset Password
- File Upload in Node.Js with ExpressJs
- Resize Image Before Upload using Multer Sharp
- Upload multiple file using node.js with multer module
- Upload file using node.js with multer module
- Client IP Address
- REST API Downloading File in NodeJs
- Export and Download CSV From MySQL Database
- CRUD REST API
- CRUD REST API Example 2
- Enable HTTPS using Node
- How to send EMAIL using NodeJs?
- Dynamic dependent dropdown using NodeJs?
- Autocomplete Search
- Get and Send Data From Ajax Request
- Get and Post Data using Ajax
- Passport Authentication
- Node Js Data type
- Node Js Error
- Node Js Array Function
- Node Js String Function
- Puppeter Module
How to install NodeJs?
File Name :
Run the installation
Double click on the downloaded .msi file to start the installation.
Click the Run button on the first screen to begin the installation.
Run the installation Double click on the downloaded .msi file to start the installation. Click the Run button on the first screen to begin the installation.
Check NodeJs Version.
File Name :
node -v
Or
node --version
what is npm?
File Name :
NPM is a package manager for Node. js packages, or modules
A package in Node.js contains all the files you need for a module.
Modules are JavaScript libraries you can include in your project.
Node Package Manager (NPM) provides two main functionalities .
Online repositories for node.js packages/modules which are searchable on search.nodejs.org
Command line utility to install Node.js packages, do version management and dependency management of Node.js packages.
File Name :
npm --version
Open the command line interface and tell NPM to download the package you want.
C:\Users\mahtab>npm install upper-case
Installing Modules using npm
npm install <Module Name>
Open the Node.js command prompt and execute the following command:
npm install express
npm ls
Globally install
Globally installed packages/dependencies are stored in system directory. Let's install express module using global installation. Although it will also produce the same result but modules will be installed globally.
npm install express -g
Uninstalling a Module
npm uninstall express
Searching a Module
npm search express
Node.js Console/REPL
Node.js comes with virtual environment called REPL. REPL stands for Read-Eval-Print-Loop. It is a quick and easy way to test simple Node.js/JavaScript code.
To launch the REPL, open command prompt (in Windows) or terminal (in Mac or UNIX/Linux) and type node as shown below. It will change the prompt to > in Windows and MAC.
node
You can now test pretty much any Node.js/JavaScript expression in REPL. 10 + 20 will display 30 immediately in new line.
The + operator also concatenates strings as in browser's JavaScript.
REPL Command :- Description
.help :- Display help on all the commands
tab Keys :- Display the list of all commands.
Up/Down Keys :- See previous commands applied in REPL.
.save filename :- Save current Node REPL session to a file.
.load :- filename Load the specified file in the current Node REPL session.
ctrl + c :- Terminate the current command.
ctrl + c (twice) :- Exit from the REPL.
ctrl + d :- Exit from the REPL.
.break :- Exit from multiline expression.
.clear :- Exit from multiline expression.