Quick Contact

    Node Package Manager

    NPM is most important topic in Node JS. Node JS provides lot of features and one of them is Non-Blocking I/O and the other one is NPM, the package manager. When you build applications or websites, you need to use some external libraries, some external dependencies. But now thing matters is speed, like if you want a way to connect with database, you can build API by your own which help you to connect your application with database. Like you have an object, you have some properties, so by building a module by yourself, as you can build everything by yourself.

    But when you have a common task or common problem, as there are millions of developers and they have built same thing which you are doing so why can’t you create a module which will be used by everyone. So let solve a big problem, and convert it into small problems and then every problem and every solution will be one module. What you can do is you can push respective module to the repository so that entire world can use it. As all the applications have some common features and you can put them in modules.

    Same there with Node JS. Node has lot of inbuilt modules that you already seen like HTTP. But what if you work with file system then we have a module for that, what if you want to work with cryptography, you have module for that. So, node JS has some inbuilt modules but what if you want extra modules, want to use someone else’s modules that’s you have a concept of NPM which is Node Package Manager.

    Now this concept is there in multiple languages when you work on Java, you have libraries there, you have dependencies there which you can use like maven, gradle but they have different approach. But in terms of NPM, it has millions of packages available. If you have a module which you have created so you can push that module to the github and the entire world will use it.

    So package here using is MangoDB for connecting with the database as it is official so you can use it. Soon you will use Express JS.

    Express is framework for web development in node JS. And if you talk about Express then it is so fast and opinionated. When you install NP or when you install Node JS, you will get NPM as well. To install write in prompt, install Express, so this is the command to execute, to install packages and once you install the package you can use it in your project. But after installation how you will use it. The way you have used HTTP, as HTTP is inbuilt module in Node JS and that’s why you have to download it from NPM, so you can simply say “require” and mention the module name same thing is there for express. So, just mention “require Express” and it will give you Express Framework. And once you install Express, there will be different modules available.

    Copyright 1999- Ducat Creative, All rights reserved.