Node JS is Platform, not a Framework---Node JS Platform Components
Node JS Platform Components
Node JS is Platform, not a Framework. It contains many components to develop, test and deploy Enterprise applications.
Node JS Components List:
Node CLI
Node JS Platform has a CLI (Command Line Interface) to run basic commands and also script files.
When we install Node JS Platform, by default we will get this component. We do not need to any extra configurations for this component.
We can observe “node.exe” file at NODSJS_HOME. It is also known as Node Platform CLI component.
How to access Node CLI:
- Open Command prompt at NODSJS_HOME
- Run “node.exe” command
Now we are able to see NODE CLI i.e. “>”, that means our Node JS Setup is working fine.
Here we can run basic Java Script commands one by one or entire Java Script files (*.js files) to test the basic functionality.
NPM
NPM stands for Node Package Manager. NPM is used to install, update, uninstall and configure Node JS Platform modules/packages very easily.
When we install Node JS Base Platform, it installs only few components, modules and libraries like Node CLI, NPM etc. From this point, we can use NPM to upgrade Node JS Platform with our required modules.
By default Node JS platform install NPM module. We can observe this at NODEJS_HOME\node_modules folder as shown below.
When we install any other required modules, we can observe new folders here. That means for each module or package, Node JS maintains a separate folder here.
We can observe “npm.cmd” in Windows environment at NODEJS_HOME. This command is used to run NPM component from command prompt.
NOTE: In simple words, Maven is used to build Java modules into jar files and NPM is used to create, install, install and update Node Modules.
To check npm version, run “npm -v command as shown in below image.
NPM Command Syntax
- NPM Install to install a module
For example,
npm install –g express
command is used to install Express Module.Sl No. Command Parts Description 1. -g It tells install this module globally that is with all administrator permissions. 2. express Express module or package unique name We will discuss in-detail about each module installation in coming posts.
When we install modules by using npm, it use two modes install at two difference locations.
Local Mode: When we install Node JS Platform, by default it uses Local Mode to install npm module in node_modules directory as shown in below screen shot.
Sample command for installing express module would be “npm install express“.
Global Mode: When we use npm command with –g option, it uses Global Mode to install modules as shown in below screen shot for “npm install –g express” command.
Here “express” module is installed with Global Mode.
- NPM uninstall to uninstall or remove an existing module;
- NPM update to update an existing module;
package.json
“package.json” is plain text file in JSON format. It is used to manage our application required module dependencies. We should place this file in our application root folder.
It defines information like our application name, module dependencies, module versions etc. This configurations file is very important and requires more time to explain in detail. We will discuss it in detail with some examples in coming posts.
Sample package.json file;
{
"name" : "sampleapp",
"version" : "1.0.0",
"dependencies" : {
}
}
Node Modules
Node JS is more modular platform. Each functionality is implemented by a separate module or package. It has some core modules like npm, install, uninstall, update etc and rest all modules are third-party modules.
When we install Node JS Platform, by default only one module is installed i.e. npm module. We need to use “npm” command to install required modules one by one.
All Core or Default modules are installed at /lib folder as *.js files as show below. In our case this path refers to “D:\NodeJS.V.0.12.0\node_modules\npm\lib”.
Node JS has thousands of modules, but here we are going to provide some of the popular modules. We will discuss and provide some examples about these modules in coming posts.
While writing this post, Node JS Platform supports the following number of packages.
A full list of Node JS Platform’s packages or modules can be found on the NPM website https://npmjs.org/.
Some of the Node JS Modules are written in Java Script and some are in C/C++ Language.
Development Tools and Frameworks
As Node JS Platform became very popular to develop Data-Sensitive Real-time and Network applications, many companies have developed some tools and framework to ease and reduce the overhead of Node JS applications.
Category | Framework/Tools |
---|---|
IDE | Eclipse with node.js plugins, Jetbrains Webstorm, Cloud9 IDE, Visual Studio Node JS Toolkit |
Database | Mongoose for MongoDB |
UI Build Tools | Grunt, Yeoman, Gulp |
CLI | Node CLI, grunt-cli |
Authentication | Passport.js |
UI Library Management | Bower |
UI Frameworks | Backbone.js, Angular.js, Ember.js |
Layout Frameworks | Twitter Bootstrap Framework |
Template Engine | Jade, EJS, Hogan.JS |
CSS Engine | Stylus, LESS, Compass |
Unit Testing Frameworks | Jasmin, Node Unit |
We will try to use some of these frameworks and tools to develop our Node JS examples in coming posts.
https://www.journaldev.com/7423/node-js-components-modules-npm-install-update-uninstall-example
相关文章
- JS框架_(JQuery.js)高德地图api
- 【nodejs原理&源码赏析(7)】【译】Node.js中的事件循环,定时器和process.nextTick
- js笔记:匿名函数
- [Node.js] Mock an API for Local Development in React with Mirage JS
- [Node.js] Use nodejs-dashboard event loop delay with hrtime()
- 使用 Node.js 搭建API 网关
- [Node.js] Add node.js command line to global
- [NPM] Use npx to run commands with different Node.js versions
- [Node.js] Pass command line arguments to node.js
- [Node.js] Use Realm Object Database with Node.js
- [Whole Web, Node.js, PM2] Restarting your node.js app on code change using pm2
- [Node.js] What 'npm install' give us?
- 如何使用微信JS-SDK实际分享功能
- Atitit mybatis 翻页解决法 目录 1.1. 翻页模式还有js翻页前端翻页更加简单1 1.2. 逻辑分页使用类RowBounds vs 物理分页 offset模式1 1.3.
- 关于 Node.js 参数 max-old-space-size
- Node.js:insert-sql帮助开发者生成SQL插入语句
- Node.js:Jest测试框架测试test代码
- Node.js(一)概述、全局对象/函数、node各模块使用介绍
- js判断是否微信PC端打开内置浏览器
- JS从0到1——最长公共字符串后缀