what is the use of node.js in angular - node.js

I am new to Angular I am trying to understand what is the use of node.js in angular application
docs
The Angular CLI, Angular applications, and Angular itself depend upon
features and functionality provided by libraries that are available as
npm packages.
You can download and install these npm packages with the npm client,
which runs as a Node.jsĀ® application.
My question is we are using node.js just because npm is shipped with it or there are other reasons Based on my understanding node.js provides a runtime environment which lets you run javascript outside browser but we are not running angular application outside the browser it's running in browser so why node.js

Angular 2/4/5 is not dependent on any server side technology. You can use it independently.
In case of Angular CLI however, NPM Serves as a package managing tool for your Angular project AND it is dependent to Node.js.

Related

Is it necessary to install Electron module and save it as devDependencies in project folder or install it globally?

I'm working with Electron to build an app and I find that we can install Electron module globally by npm install -g electron instead of npm install --save-dev electron as the documentations said. I think this will reduce the app size. But I'm afraid of there will be an error when packaging the source code or while the user use the app. Can we install Electron module globally without any error and if can, will the app size reduce when we package it?
Installing Electron locally (within your project) or globally will make no difference to the size of the built application.
It is common practice to install Electron locally within your project as a dev-dependency. Doing so will prevent the need to constantly change its version number when working on different Electron applications should their Electron version numbers differ.
When your application is built, all the necessary binaries, etc are packaged up within your application. IE: Your built Electron application is self-contained.
No, you need to install it locally in the package, because as you say, packaging the app will fail.
Actually, you won't even be able to build your app.
Something like what you're describing has been suggested on their Github page. See here, but I doubt they'll implement this any time soon.

Is there a difference between using npm and node.js?

I'm using npm to download libraries.
Is it correct to say that I'm using node.js ?
NPM is a package manager for Node.js packages, or modules.
NPM hosts thousands of free packages to download and use.
The NPM program is installed on your computer when you install Node.js
Node.js As an asynchronous event-driven JavaScript runtime, Node.js is designed to build scalable network applications.
https://nodejs.org/en/about/
Node.js is all about modularity, and with that comes the need for a quality package manager; for this purpose, npm was made. With npm comes the largest selection of community-created packages of any programming ecosystem, which makes building Node.js apps quick and easy.
https://nodejs.org/en/docs/meta/topics/dependencies/#npm
Hope I helped you see the differences.Best Regards !
Yes nodejs is a runtime environment for javascript docs here like JRE is for java. You can use Node to run javascript in you system otherwise you need a browser to run it
NPM is a library for javascript read here, you use that to install libraries incase you need to use some extra features you dont wanna code yourself
Nodejs can run w/o use of npm like you can use other library repo like yarn likewise you can use other run time environment like Deno and use npm with that w/o using node

Angular2 development Without node and npm

I am new angular2 development, and what i came to know is before starin the angular2 development, I must install the nodejs for server and npm to download dependencies from official documentation.
I succesfully deployed the source code in tomcat sever[by build]
So my Question is after installation and creating the new project, i got node_modules. By using these node_modules(can i start development of angular2 on another i.e a new machine where node & npm is not installed)
Basically my question is.. I want to start development of angular2 by using the project structure on new machine. Without the installation on node & npm
From Angular docs
Node.js and npm are essential to Angular development.
If you built/compiled the app and have all the modules installed (you have your node_modules) folder then its just javascript and html which you can run on any server you want.
For npm, if you need any modules/packages, I think you can manually download the package and add it to your development environment. But what if the process needs to be automated? You can't just sit there and download all the packages from github. So npm is really helpful when it come to this. You only need a file containing all dependencies, and run it at build time (package.json)
About nodejs, nodejs allows you to run javascript on the server when you need any interaction with the database. So why don't we just go with the easy way?

What is the difference between node.js runtime and npm package manager options while installing node.JS?

I am trying to install node.js by downloading the .exe file, I am confused and stuck on the Node.js setup where in it asks to install node.js runtime or npm package manager so I want to proceed through the installation after knowing fully the difference between the two.
My question is what is the difference between node.js runtime and npm
pacakage manager and what are all the features do I get on the two
options.
My basic purpose of installing node.js is to compile Typescript, Please help me to understand the features of the two package
First of all, it does not ask you to install Node.js runtime OR npm package manager, it offers you to install them both (if you want)
Now, Node.js runtime is basically what will understand your javascript code and execute it to produce a result.
Npm package manager is a tool which will allow you to install third party libraries (other people's code) by using the command line.
npm install express
will install the framework called express for example.
Node JS
Node.js is a platform built on Chrome's JavaScript runtime for easily
building fast, scalable network applications.
Real-Time services (Chat, Games etc)
NPM
Npm is a package manager. Typically this software is installed to
build Node applications.
It let's you install software (libraries, plugins, frameworks and
applications).
Node.js or Node is an open-source, cross-platform, JavaScript runtime environment(JSRE) that executes JavaScript code outside of a web browser.
npm is a package manager(like Nuget package manager in .NET -Microsoft ) for the JavaScript programming language. It is the default package manager for the JavaScript runtime environment Node.js.
You can differentiate them by finding their version using below code.
node --version
npm --version
node is a framework that can run JavaScript code on your machine while npm is a package manager. Using npm we can install and remove javascript packages also known as node modules. Now, it is not a rule that you should use npm to install and remove node modules. We can use yarn also. npm and yarn are capable of the following:
Read and understand package.json file
Download and put javascript modules in node_modules folder.
Run scripts mentioned in package.json such as starting a node server, running in dev and production mode, running scripts for unit testing etc.
npm by default run node server.js; if you didn't specify scripts in the package.json
"scripts": {
"start": "node your-script.js"
}
Which means npm run node
if you need use yarn, you'd better choose node.js runtime, usually the default choice is a better one for beginner //TAT

using goinstant with node.js in order to use webrtc

i try to implement a collaborative work plateforme based on node.js in back-end that ok
but i want to integrate webrtc and visoconferance it's possible and how to use goinstant in BAAS
gortc is published as a component.io component so you won't find it on npm. To build the webrtc widget simply run npm install then grunt build.
Alternatively, you can install an already built version via bower:
bower install goinstant-webrtc
or use a build hosted on GoInstant's CDN:
https://cdn.goinstant.net/widgets/webrtc/latest/webrtc.min.js
https://cdn.goinstant.net/widgets/webrtc/latest/webrtc.css
For the full webrtc-demo you get that error message if redis is not running/found. To start redis do: redis-server.

Resources