zoukankan      html  css  js  c++  java
  • 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.js-Components

    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:

    1. Open Command prompt at NODSJS_HOME
      Node.js-CLI-1
    2. Run “node.exe” command

      Node.js-CLI-2

      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 ode_modules folder as shown below.

    Node.js-NPM-Home

    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.
    Node.js-NPM-cmd

    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.

    Node.js-npm-version

    NPM Command Syntax

    • NPM Install to install a module

      Node.js-npm-install-module

      For example, npm install –g express command is used to install Express Module.

      Sl No.Command PartsDescription
      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. 

      Node.js-NPM-Home

      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.

      Node.js-npm-install-module-global

      Here “express” module is installed with Global Mode.

    • NPM uninstall to uninstall or remove an existing module;

      Node.js-npm-uninstall-module

    • NPM update to update an existing module;

      Node.js-npm-update-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 ode_modules pmlib”.

    Node.js-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.

    Node.js-popular-modules

    While writing this post, Node JS Platform supports the following number of packages.

    NodeJS-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.

    CategoryFramework/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

  • 相关阅读:
    判断一个数是否是偶数,你真的仔细去考虑过么
    由懒加载所引出的性能优化
    DSAPI之摄像头追踪指定颜色物体
    DSAPI多功能组件编程应用反射相关
    DSAPI HTTP监听服务端与客户端_指令版
    DSAPI多功能组件编程应用网络相关(中)
    DSAPI多功能组件编程应用网络相关(上)
    DSAPI多功能组件编程应用HTTP监听服务端与客户端
    DSAPI HTTP监听服务端与客户端
    DSAPI多功能组件编程应用图形图像篇(中)
  • 原文地址:https://www.cnblogs.com/feng9exe/p/12187736.html
Copyright © 2011-2022 走看看