From 7458c557882d092ffef8dd2daf9027eff216ca8d Mon Sep 17 00:00:00 2001 From: CodeWAdi <110481392+CodeWAdi@users.noreply.github.com> Date: Sun, 2 Oct 2022 19:37:07 +0530 Subject: [PATCH] Node.js docs (#2019) * Updated content in various nodes in NodeJS -Why nodejs, Installing NodeJS , CommonJS vs ESM , Global keyword,npm workspaces , creating packages , __dirname , __filename Updated various sub groups with information in NODEJS * Update content/roadmaps/107-nodejs/content/100-nodejs-introduction/101-why-nodejs.md * Update content/roadmaps/107-nodejs/content/100-nodejs-introduction/101-why-nodejs.md * Update content/roadmaps/107-nodejs/content/100-nodejs-introduction/104-running-nodejs-code.md * Update content/roadmaps/107-nodejs/content/100-nodejs-introduction/101-why-nodejs.md * Update content/roadmaps/107-nodejs/content/101-nodejs-modules/100-commonjs-vs-esm.md * Update content/roadmaps/107-nodejs/content/101-nodejs-modules/102-global-keyword.md * Update content/roadmaps/107-nodejs/content/100-nodejs-introduction/101-why-nodejs.md * Update content/roadmaps/107-nodejs/content/100-nodejs-introduction/101-why-nodejs.md * Update 101-why-nodejs.md * Update content/roadmaps/107-nodejs/content/102-nodejs-npm/105-npm-workspaces.md * Update content/roadmaps/107-nodejs/content/102-nodejs-npm/106-creating-packages.md * Update content/roadmaps/107-nodejs/content/105-nodejs-working-with-files/107-dirname.md * Update content/roadmaps/107-nodejs/content/105-nodejs-working-with-files/108-filename.md Co-authored-by: Kamran Ahmed --- .../100-nodejs-introduction/101-why-nodejs.md | 14 +++++++++++++- .../104-running-nodejs-code.md | 7 ++++++- .../101-nodejs-modules/100-commonjs-vs-esm.md | 9 ++++++++- .../101-nodejs-modules/102-global-keyword.md | 7 ++++++- .../content/102-nodejs-npm/105-npm-workspaces.md | 8 +++++++- .../102-nodejs-npm/106-creating-packages.md | 8 +++++++- .../105-nodejs-working-with-files/107-dirname.md | 8 +++++++- .../105-nodejs-working-with-files/108-filename.md | 7 ++++++- 8 files changed, 60 insertions(+), 8 deletions(-) diff --git a/content/roadmaps/107-nodejs/content/100-nodejs-introduction/101-why-nodejs.md b/content/roadmaps/107-nodejs/content/100-nodejs-introduction/101-why-nodejs.md index 24481f91e..bf349cbc7 100644 --- a/content/roadmaps/107-nodejs/content/100-nodejs-introduction/101-why-nodejs.md +++ b/content/roadmaps/107-nodejs/content/100-nodejs-introduction/101-why-nodejs.md @@ -1 +1,13 @@ -# Why nodejs \ No newline at end of file +# Why Node.js + +* Node.js is OpenSource +* Guarantees ease of scaling applications vertically by adding new resources to the existing node and horizontally with the addition of new nodes +* It facilitates building separate components that easily complement larger applications, which means saving money at the initial development stages and potentially shortening time-to-market, reusable code (some of the code can be used both on the front and backend) +* Tested on production (a lot of [companies use it](https://selleo.com/blog/10-successful-companies-using-nodejs) from the very beginning in 2009) +* offers improved performance thanks to Chrome’s V8 engine +* using JavaScript on both backend and frontend makes Node a great choice to improve speed and simplicity of implementation + +Free Content +Learn Node.js +Why Choose Node.js? +5 Reasons to Choose Node.js diff --git a/content/roadmaps/107-nodejs/content/100-nodejs-introduction/104-running-nodejs-code.md b/content/roadmaps/107-nodejs/content/100-nodejs-introduction/104-running-nodejs-code.md index 0a69ae77c..f95503ce6 100644 --- a/content/roadmaps/107-nodejs/content/100-nodejs-introduction/104-running-nodejs-code.md +++ b/content/roadmaps/107-nodejs/content/100-nodejs-introduction/104-running-nodejs-code.md @@ -1 +1,6 @@ -# Running nodejs code \ No newline at end of file +# Running Node.js Code + +The usual way to run a Node.js program is to run the globally available `node` command (once you install Node.js) and pass the name of the file you want to execute. + +Free Content +Run Node.js from Command Line \ No newline at end of file diff --git a/content/roadmaps/107-nodejs/content/101-nodejs-modules/100-commonjs-vs-esm.md b/content/roadmaps/107-nodejs/content/101-nodejs-modules/100-commonjs-vs-esm.md index 8e8b15f00..5197b0bbf 100644 --- a/content/roadmaps/107-nodejs/content/101-nodejs-modules/100-commonjs-vs-esm.md +++ b/content/roadmaps/107-nodejs/content/101-nodejs-modules/100-commonjs-vs-esm.md @@ -1 +1,8 @@ -# Commonjs vs esm \ No newline at end of file +# CommonJS vs ESM + +The CommonJS module system, on the other hand, is built into Node.js. Before the introduction of the ES module in Node.js, CommonJS was the standard for Node.js modules. As a result, many Node.js libraries and modules are written with CommonJS. + +The ES module format was created to standardize the JavaScript module system. It has become the standard format for encapsulating JavaScript code for reuse. + +Free Content +CommonJS vs ESM \ No newline at end of file diff --git a/content/roadmaps/107-nodejs/content/101-nodejs-modules/102-global-keyword.md b/content/roadmaps/107-nodejs/content/101-nodejs-modules/102-global-keyword.md index 5edcdbfdc..901a42751 100644 --- a/content/roadmaps/107-nodejs/content/101-nodejs-modules/102-global-keyword.md +++ b/content/roadmaps/107-nodejs/content/101-nodejs-modules/102-global-keyword.md @@ -1 +1,6 @@ -# Global keyword \ No newline at end of file +# global Keyword + +In browsers, the top-level scope is the global scope. This means that within the browser var something will define a new global variable. In Node.js this is different. The top-level scope is not the global scope; `var something` inside a Node.js module will be local to that module. + +Free Content +global Keyword in Node.js \ No newline at end of file diff --git a/content/roadmaps/107-nodejs/content/102-nodejs-npm/105-npm-workspaces.md b/content/roadmaps/107-nodejs/content/102-nodejs-npm/105-npm-workspaces.md index 50afa3304..1251b332d 100644 --- a/content/roadmaps/107-nodejs/content/102-nodejs-npm/105-npm-workspaces.md +++ b/content/roadmaps/107-nodejs/content/102-nodejs-npm/105-npm-workspaces.md @@ -1 +1,7 @@ -# Npm workspaces \ No newline at end of file +# npm workspaces + +Workspace is a generic term that refers to the set of npm CLI features that support managing multiple packages from your local file system from within a singular top-level root package. + +Free Content +npm workspaces +Getting Started with Npm Workspaces diff --git a/content/roadmaps/107-nodejs/content/102-nodejs-npm/106-creating-packages.md b/content/roadmaps/107-nodejs/content/102-nodejs-npm/106-creating-packages.md index d66f08388..c93a3643d 100644 --- a/content/roadmaps/107-nodejs/content/102-nodejs-npm/106-creating-packages.md +++ b/content/roadmaps/107-nodejs/content/102-nodejs-npm/106-creating-packages.md @@ -1 +1,7 @@ -# Creating packages \ No newline at end of file +# Creating Packages + +npm packages allow you to bundle some specific functionality into a reusable package which can then be uploaded to some package registry such as npm or GitHub packages and then be installed and reused in projects using npm. + +Free Content +How to make a tiny npm package and publish it +Best practices for creating a modern npm package \ No newline at end of file diff --git a/content/roadmaps/107-nodejs/content/105-nodejs-working-with-files/107-dirname.md b/content/roadmaps/107-nodejs/content/105-nodejs-working-with-files/107-dirname.md index af30af200..f93534cf5 100644 --- a/content/roadmaps/107-nodejs/content/105-nodejs-working-with-files/107-dirname.md +++ b/content/roadmaps/107-nodejs/content/105-nodejs-working-with-files/107-dirname.md @@ -1 +1,7 @@ -# Dirname \ No newline at end of file +# __dirname + +The `__dirname` in a node script returns the path of the folder where the current JavaScript file resides. `__filename` and `__dirname` are used to get the filename and directory name of the currently executing file. + +Free Content +Official Website +How to use __dirname \ No newline at end of file diff --git a/content/roadmaps/107-nodejs/content/105-nodejs-working-with-files/108-filename.md b/content/roadmaps/107-nodejs/content/105-nodejs-working-with-files/108-filename.md index bb51b1d73..f374189d6 100644 --- a/content/roadmaps/107-nodejs/content/105-nodejs-working-with-files/108-filename.md +++ b/content/roadmaps/107-nodejs/content/105-nodejs-working-with-files/108-filename.md @@ -1 +1,6 @@ -# Filename \ No newline at end of file +# __filename + +The `__filename` in Node.js returns the filename of the executed code. It gives the absolute path of the code file. The following approach covers implementing `__filename` in the Node.js project. + +Free Content +Official Docs \ No newline at end of file