You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+17-16Lines changed: 17 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -579,7 +579,7 @@ var events = require('events');
579
579
var eventEmitter =newevents.EventEmitter();
580
580
```
581
581
582
-
Example
582
+
*Example*:
583
583
584
584
```javascript
585
585
// Import events module
@@ -757,7 +757,7 @@ All objects that emit events are members of EventEmitter class. These objects ex
757
757
758
758
When the EventEmitter object emits an event, all of the functions attached to that specific event are called synchronously. All values returned by the called listeners are ignored and will be discarded.
759
759
760
-
Example
760
+
*Example*:
761
761
762
762
```javascript
763
763
var events =require('events');
@@ -833,7 +833,7 @@ There are four types of streams
833
833
834
834
Each type of Stream is an EventEmitter instance and throws several events at different instance of times.
835
835
836
-
Example
836
+
*Example*:
837
837
838
838
***data** − This event is fired when there is data is available to read.
839
839
***end** − This event is fired when there is no more data to read.
@@ -983,10 +983,10 @@ console.log(decrypted);
983
983
DNS is a node module used to do name resolution facility which is provided by the operating system as well as used to do an actual DNS lookup. No need for memorising IP addresses – DNS servers provide a nifty solution of converting domain or subdomain names to IP addresses. This module provides an asynchronous network wrapper and can be imported using the following syntax.
Example: print the localhost name using `lookupService()` function
1017
+
*Example*: print the localhost name using `lookupService()` function
1018
1018
1019
1019
```javascript
1020
1020
constdns=require('dns');
@@ -1125,7 +1125,7 @@ There are two types of API functions in Node.js:
1125
1125
1126
1126
In a blocking operation, all other code is blocked from executing until an I/O event that is being waited on occurs. Blocking functions execute synchronously.
1127
1127
1128
-
Example:
1128
+
*Example*:
1129
1129
1130
1130
```javascript
1131
1131
constfs=require('fs');
@@ -1140,7 +1140,7 @@ The second line of code blocks the execution of additional JavaScript until the
1140
1140
1141
1141
In a non-blocking operation, multiple I/O calls can be performed without the execution of the program being halted. Non-blocking functions execute asynchronously.
1142
1142
1143
-
Example:
1143
+
*Example*:
1144
1144
1145
1145
```javascript
1146
1146
constfs=require('fs');
@@ -2049,8 +2049,9 @@ As a minimal framework, Express does not consider database integration as a requ
2049
2049
2050
2050
## 56Q. ***What are the Challenges with Node.js?***
2051
2051
2052
-
**Challenges with Node.js Application Maintenance**
2053
-
Improper maintenance of an application can result in issues related to stability or flexibility, often leading to the app’s failure. If the code is not well-written or if developers use outdated tools, the performance can suffer, and users might experience more bugs and app crashes. On top of that, poor-quality code can hamper the app’s scaling capacity and the further development of the application. In the worst case scenario, it might become impossible to introduce new features without rewriting the codebase from scratch.
2052
+
**Challenges with Node.js Application Maintenance**
2053
+
2054
+
Improper maintenance of an application can result in issues related to stability or flexibility, often leading to the app\'s failure. If the code is not well-written or if developers use outdated tools, the performance can suffer, and users might experience more bugs and app crashes. On top of that, poor-quality code can hamper the app’s scaling capacity and the further development of the application. In the worst case scenario, it might become impossible to introduce new features without rewriting the codebase from scratch.
2054
2055
2055
2056
1. Extensive stack
2056
2057
2. Technical Debt
@@ -2069,7 +2070,7 @@ Improper maintenance of an application can result in issues related to stability
2069
2070
2070
2071
## 57Q. ***What is the difference between Node.js vs Ajax?***
2071
2072
2072
-
**AJAX**
2073
+
**1. AJAX**
2073
2074
2074
2075
AJAX stands for Asynchronous Javascript and XML, it’s used to allow web pages (client-side) to update asynchronously by communicating with a web server and by exchanging data. This essentially means that applications can talk to a server in the background of the application. It uses some core components to function:
2075
2076
@@ -2079,7 +2080,7 @@ AJAX stands for Asynchronous Javascript and XML, it’s used to allow web pages
2079
2080
1. JSON/XML for interchanging the data
2080
2081
1. Javascript to unify everything
2081
2082
2082
-
**Node.js**
2083
+
**2. Node.js**
2083
2084
2084
2085
Node.js allows the developers to develop a web application in a single language called JavaScript for both client side and server side.
2085
2086
@@ -2131,7 +2132,7 @@ async function add(x,y){
2131
2132
2132
2133
Async functions can make use of the await expression. This will pause the async function and wait for the Promise to resolve prior to moving on.
2133
2134
2134
-
Example
2135
+
*Example*:
2135
2136
2136
2137
```javascript
2137
2138
functiondoubleAfter2Seconds(x) {
@@ -2273,7 +2274,7 @@ callback functions are called when an asynchronous function returns its result,
2273
2274
2274
2275
**1. Callback**: A callback function is a function passed into another function as an argument, which is then invoked inside the outer function to complete some kind of routine or action.
2275
2276
2276
-
*Example:* synchronous callback
2277
+
*Example*: synchronous callback
2277
2278
2278
2279
```js
2279
2280
functiongreeting(name) {
@@ -2290,7 +2291,7 @@ processUserInput(greeting);
2290
2291
2291
2292
**2. Events**: Every action on a computer is an event. Node.js allows us to create and handle custom events easily by using events module. Event module includes `EventEmitter` class which can be used to raise and handle custom events.
0 commit comments