Using Node JS for Frontend

I heard about Node.js, which is used on the outside of the application as opposed to the outside, but I cannot find any use cases for which it can be used. Can anyone explain the use cases for which Node.js is used in the frontend.

In addition, for a fairly complex system, such as a CMS (content management system) for an e-commerce site, is Node.js the right choice?

Thank you in advance

+5
source share
2 answers

Node.js is a javascript runtime that uses the JavaScript engine for JavaScript V8. The interface already uses the JavaScript engine in the browser (V8 for Chrome, SpiderMonkey for Firefox, Chakra for Edge), so if Javascript works in the browser in Node.js, you can expect very similar environments.

However, you may be interested in using Node.js modules on the interface. Modules are packaged using a tool called npm . You can use module loaders or bundles like Browserify , webpack or Rollup.js to accomplish this.

+4
source

You typically use Node.js and its ecosystem as part of your toolchain when developing external applications, but the deployed application will continue to be just plain JavaScript that runs in a custom browser. You can use Node's npm package npm instead of Bower to manage your external dependencies, for example.

And there is Browserify , which will allow you to use the npm packages that were created for Node in your external JavaScript application (which runs inside a user browser).

+3
source

Source: https://habr.com/ru/post/1241363/


All Articles