Web / NodeJS
/* Hello World! program using Node.js */ console.log("Hello World!");
Node.js is a powerful server side JavaScript based framework/platform built on Google Chrome's JavaScript V8 Engine.
It enables the development of I/O intensive web applications like video streaming sites, single-page applications (SPA) and other web applications.
Yes.
Application that involves cpu processing.
npm makes it easy for JavaScript developers to share and reuse code, and it makes it easy to update the code that you're sharing.
Use npm list for local packages or npm list -g for globally installed packages.
To find the version of the particular package given that the package name is known, use the command npm list package-name.
Transpiling refers to the process of taking source code written in one language and transforming into another language that has a similar level of abstraction.
The below logging npm libraries are available for NodeJS projects.
- Log4js,
- Winston,
- debug,
- and Bunyan.
Use the compression middleware for gzip compression in your Express app. Gzip compressing decrease the size of the response body and hence increase the speed of a web app.
First, install the npm package in your project for compression:
$ npm i compression --save
You can use the module in your application.
var compression = require('compression') var express = require('express') var app = express() app.use(compression())
NestJS is a progressive Node.js framework for building efficient, reliable and scalable server-side applications.
- Core module in Node.JS.
- Uses the Chrome DevTools (CDT) protocol.
- Can connect to local or remote V8 engine.
Npm is a tool that use to install packages. Npx is a tool that use to execute node packages. NPX comes bundled with the NPM.
Both npm and Yarn are great package managers for Node.js and Javascript. Yarn was built by Facebook to solve major problems they faced with npm, such as the slower installation of packages and to address few security issues in npm.
Parallel installation of packages: Yarn installs packages in parallel, thus increasing performance and speed. NPM waits for a package to be fully installed before installing another package.
Automatic Lock file generation: Yarn automatically adds a yarn.lock file when dependencies are added to use the version from package.json. NPM doesn't create the lock file by default.
Security: NPM automatically executes a code that allows the other packages to get included into the fly, thus resulting in several vulnerabilities in the security system. On the other hand, Yarn installs those files which are only from the yarn.lock or package.json files.
Command for | npm | yarn |
Install dependencies from package.json | npm install | yarn |
Install package | npm install [package] | yarn add [package] |
Install dev dependency | npm install --save-dev [package] | yarn add --dev [package] |
Uninstall package | npm uninstall [package] | yarn remove [package] |
Update package | npm update [package] | yarn upgrade [package] |
Install package global | npm install --global [package] | yarn global add [package] |
Uninstall package global | npm uninstall --global [package] | yarn global remove [package] |