<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>nodejs Archives - scmGalaxy</title>
	<atom:link href="https://www.scmgalaxy.com/tutorials/tag/nodejs/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.scmgalaxy.com/tutorials/tag/nodejs/</link>
	<description>A Platform for Software Engineers</description>
	<lastBuildDate>Sat, 21 Feb 2026 07:13:37 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.1</generator>
	<item>
		<title>Mastering Meteor: Use Cases, Architecture, Workflow, and Getting Started</title>
		<link>https://www.scmgalaxy.com/tutorials/mastering-meteor-use-cases-architecture-workflow-and-getting-started/</link>
					<comments>https://www.scmgalaxy.com/tutorials/mastering-meteor-use-cases-architecture-workflow-and-getting-started/#respond</comments>
		
		<dc:creator><![CDATA[Vijay K]]></dc:creator>
		<pubDate>Thu, 05 Jun 2025 16:23:00 +0000</pubDate>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[FullStackDevelopment]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Meteor]]></category>
		<category><![CDATA[nodejs]]></category>
		<category><![CDATA[RealtimeApplications]]></category>
		<category><![CDATA[WebDevelopment]]></category>
		<guid isPermaLink="false">https://www.scmgalaxy.com/tutorials/?p=12565</guid>

					<description><![CDATA[<p>What is Meteor? Meteor is an open-source, full-stack JavaScript framework that enables developers to build web and mobile applications in [&#8230;]</p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/mastering-meteor-use-cases-architecture-workflow-and-getting-started/">Mastering Meteor: Use Cases, Architecture, Workflow, and Getting Started</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<figure class="wp-block-image size-full"><img fetchpriority="high" decoding="async" width="776" height="378" src="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2025/06/meteor-banner.jpg" alt="" class="wp-image-12570" srcset="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2025/06/meteor-banner.jpg 776w, https://www.scmgalaxy.com/tutorials/wp-content/uploads/2025/06/meteor-banner-300x146.jpg 300w, https://www.scmgalaxy.com/tutorials/wp-content/uploads/2025/06/meteor-banner-768x374.jpg 768w" sizes="(max-width: 776px) 100vw, 776px" /></figure>



<hr class="wp-block-separator has-alpha-channel-opacity">



<h3 class="wp-block-heading"><strong>What is Meteor?</strong></h3>



<p class="wp-block-paragraph"><strong>Meteor</strong> is an open-source, full-stack JavaScript framework that enables developers to build <strong>web and mobile applications</strong> in a seamless, unified environment. It is designed to handle both the <strong>client-side</strong> and <strong>server-side</strong> of an application in one unified stack, making development faster, easier, and more efficient.</p>



<p class="wp-block-paragraph">Meteor uses <strong>Node.js</strong> on the backend, and it integrates tightly with <strong>MongoDB</strong>, although it is agnostic to databases, allowing you to use any backend database. One of the standout features of Meteor is its <strong>real-time capabilities</strong>. Meteor makes it easier to create applications where the user interface updates dynamically in response to changes in data, without requiring the user to manually refresh the page.</p>



<p class="wp-block-paragraph">Meteor was initially created in 2011 and has been widely adopted for building modern, reactive, real-time web applications. It provides a simple, intuitive API and comes with everything you need to build apps, including:</p>



<ul class="wp-block-list">
<li>A <strong>real-time data synchronization layer</strong></li>



<li>A <strong>build tool</strong> for managing client-side assets</li>



<li>Built-in <strong>security features</strong></li>



<li>An <strong>integrated front-end framework</strong> based on Blaze (though it also supports React, Angular, and Vue)</li>



<li><strong>Full-stack reactivity</strong> through its data layer</li>
</ul>



<p class="wp-block-paragraph">With Meteor, you can quickly build both web and mobile applications that are fast, responsive, and modern.</p>



<hr class="wp-block-separator has-alpha-channel-opacity">



<h3 class="wp-block-heading"><strong>What Are the Major Use Cases of Meteor?</strong></h3>



<p class="wp-block-paragraph">Meteor is particularly suited for a variety of application types, especially those that require <strong>real-time</strong> interactions and a smooth, reactive user experience. Below are the <strong>major use cases</strong> for Meteor:</p>



<h4 class="wp-block-heading"><strong>1. Real-time Web Applications</strong></h4>



<p class="wp-block-paragraph">Meteor is an excellent choice for building applications that require <strong>live, real-time updates</strong> without the need for manual page reloads or polling.</p>



<ul class="wp-block-list">
<li><strong>Example</strong>: <strong>Collaborative apps</strong>, such as <strong>Google Docs</strong>, where multiple users can see changes in real-time.</li>



<li><strong>Chat applications</strong>: Meteor’s real-time data synchronization capabilities make it a great fit for building chat applications where messages are delivered instantly.</li>
</ul>



<h4 class="wp-block-heading"><strong>2. Single-Page Applications (SPAs)</strong></h4>



<p class="wp-block-paragraph">Single-Page Applications (SPAs) are highly dynamic web applications that load a single HTML page and update the user interface dynamically as the user interacts with the app. Meteor makes it simple to create SPAs thanks to its integrated front-end and real-time data updates.</p>



<ul class="wp-block-list">
<li><strong>Example</strong>: <strong>Dashboard applications</strong> where the user sees real-time data updates and interacts with various components of the app without refreshing the page.</li>
</ul>



<h4 class="wp-block-heading"><strong>3. Mobile Applications (React Native)</strong></h4>



<p class="wp-block-paragraph">Meteor can be used to build mobile applications in addition to web apps. It integrates well with <strong>React Native</strong>, a popular framework for building cross-platform mobile applications. The real-time capabilities of Meteor can be leveraged for mobile apps that need to sync data across multiple devices.</p>



<ul class="wp-block-list">
<li><strong>Example</strong>: <strong>Mobile chat apps</strong> or apps that require <strong>live updates</strong>, such as social media apps or notification-based apps.</li>
</ul>



<h4 class="wp-block-heading"><strong>4. E-commerce Platforms</strong></h4>



<p class="wp-block-paragraph">Meteor is well-suited for building <strong>e-commerce platforms</strong> that require dynamic updates such as product availability, user reviews, and live inventory management. The <strong>real-time data syncing</strong> feature allows for seamless interactions.</p>



<ul class="wp-block-list">
<li><strong>Example</strong>: A <strong>real-time inventory tracking system</strong> for e-commerce stores where products update immediately as they are added or removed.</li>
</ul>



<h4 class="wp-block-heading"><strong>5. Social Media Platforms</strong></h4>



<p class="wp-block-paragraph">Social media platforms benefit from Meteor’s real-time updates and its ability to handle frequent data changes efficiently.</p>



<ul class="wp-block-list">
<li><strong>Example</strong>: <strong>Newsfeeds</strong> that display posts, comments, likes, and notifications in real time as users interact with the system.</li>
</ul>



<hr class="wp-block-separator has-alpha-channel-opacity">



<h3 class="wp-block-heading"><strong>How Meteor Works Along with Architecture?</strong></h3>



<figure class="wp-block-image size-large"><img decoding="async" width="1024" height="683" src="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2025/06/image-36-1024x683.png" alt="" class="wp-image-12569" srcset="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2025/06/image-36-1024x683.png 1024w, https://www.scmgalaxy.com/tutorials/wp-content/uploads/2025/06/image-36-300x200.png 300w, https://www.scmgalaxy.com/tutorials/wp-content/uploads/2025/06/image-36-768x512.png 768w, https://www.scmgalaxy.com/tutorials/wp-content/uploads/2025/06/image-36.png 1536w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p class="wp-block-paragraph">Meteor’s architecture is designed to provide <strong>full-stack reactivity</strong>, meaning that changes to data are automatically reflected in the user interface without requiring any manual intervention. Here’s an overview of how Meteor works:</p>



<h4 class="wp-block-heading"><strong>1. Client-Side</strong></h4>



<p class="wp-block-paragraph">The <strong>client-side</strong> of a Meteor application is responsible for rendering the user interface and handling user interactions. Meteor uses a <strong>blaze template engine</strong> by default, but you can also use other popular front-end libraries like <strong>React</strong>, <strong>Vue</strong>, or <strong>Angular</strong>.</p>



<p class="wp-block-paragraph">Meteor provides <strong>two-way data binding</strong> between the client and the server, which means the data in the client automatically updates when the server updates, and vice versa.</p>



<ul class="wp-block-list">
<li><strong>UI updates</strong>: When the data model on the client changes (due to user actions or server-side updates), the UI automatically re-renders to reflect the changes.</li>
</ul>



<h4 class="wp-block-heading"><strong>2. Server-Side</strong></h4>



<p class="wp-block-paragraph">Meteor uses <strong>Node.js</strong> on the server side. The server is responsible for interacting with the <strong>database</strong> (typically <strong>MongoDB</strong>) and handling HTTP requests. Meteor simplifies server-side development by providing a <strong>real-time data sync</strong> mechanism that automatically sends updates to the client as soon as the data on the server changes.</p>



<ul class="wp-block-list">
<li><strong>Data publication</strong>: The server exposes data through <strong>publications</strong>, and the client subscribes to these publications to receive updates.</li>



<li><strong>Data subscription</strong>: The client subscribes to a publication to get a stream of data. Whenever the data changes on the server, the updates are automatically sent to the client without requiring the client to manually request the data.</li>
</ul>



<h4 class="wp-block-heading"><strong>3. Database Layer</strong></h4>



<p class="wp-block-paragraph">Meteor uses <strong>MongoDB</strong> as the default database, but it can be configured to work with any database (SQL, NoSQL) by using packages. The database is tightly coupled with Meteor’s reactive data system. When data is modified, the changes are automatically reflected on the client-side UI in real-time.</p>



<ul class="wp-block-list">
<li><strong>MongoDB Integration</strong>: Meteor uses a <strong>MongoDB-like API</strong> for managing the database schema on the client and server. The client-side stores a local copy of the data and synchronizes changes to the server as needed.</li>
</ul>



<h4 class="wp-block-heading"><strong>4. Data Synchronization and Reactivity</strong></h4>



<p class="wp-block-paragraph">One of the key features of Meteor is its <strong>real-time data synchronization</strong>. As soon as data changes on the server, the client is notified, and the UI is updated in real-time. This allows Meteor to build highly reactive and dynamic applications.</p>



<ul class="wp-block-list">
<li><strong>Pub/Sub (Publish-Subscribe Model)</strong>: The publish-subscribe model allows the server to send only the data that the client has subscribed to, ensuring efficient data transmission and minimizing unnecessary data transfers.</li>
</ul>



<h4 class="wp-block-heading"><strong>5. DDP (Distributed Data Protocol)</strong></h4>



<p class="wp-block-paragraph">Meteor uses <strong>DDP</strong> to communicate between the client and server. DDP is a protocol that allows the client to subscribe to specific pieces of data on the server and receive updates when that data changes. This protocol helps Meteor provide real-time reactivity by synchronizing data changes automatically.</p>



<hr class="wp-block-separator has-alpha-channel-opacity">



<h3 class="wp-block-heading"><strong>What Are the Basic Workflow of Meteor?</strong></h3>



<p class="wp-block-paragraph">The basic workflow in a <strong>Meteor</strong> application typically involves the following steps:</p>



<ol class="wp-block-list">
<li><strong>Defining the Data Model</strong>:
<ul class="wp-block-list">
<li>Use collections (similar to tables in a database) to define the data model. Collections hold the data that is used by the app and can be accessed or modified by both the client and server.</li>
</ul>
</li>



<li><strong>Creating Publications on the Server</strong>:
<ul class="wp-block-list">
<li>On the server side, define <strong>publications</strong> that expose certain data to the client. A publication might send data from a MongoDB collection or any other data source.</li>
</ul>
</li>



<li><strong>Subscribing to Data on the Client</strong>:
<ul class="wp-block-list">
<li>On the client side, use <strong>subscriptions</strong> to request data from the server. Once the subscription is established, any changes to the data are automatically pushed to the client.</li>
</ul>
</li>



<li><strong>Real-Time Data Synchronization</strong>:
<ul class="wp-block-list">
<li>Meteor’s <strong>real-time data synchronization</strong> ensures that changes in the data (on the server) are immediately reflected in the UI (on the client) without the need for the user to refresh the page.</li>
</ul>
</li>



<li><strong>Updating the UI</strong>:
<ul class="wp-block-list">
<li>When the data model changes, Meteor automatically triggers a UI update through its <strong>reactivity system</strong>. The UI reacts to changes in the underlying data and re-renders accordingly.</li>
</ul>
</li>



<li><strong>Handling User Input</strong>:
<ul class="wp-block-list">
<li>The client side can capture user input (e.g., button clicks, form submissions) and update the server-side data accordingly. Meteor’s full-stack reactivity ensures that the updates are synchronized and reflected in real-time.</li>
</ul>
</li>
</ol>



<hr class="wp-block-separator has-alpha-channel-opacity">



<h3 class="wp-block-heading"><strong>Step-by-Step Getting Started Guide for Meteor</strong></h3>



<p class="wp-block-paragraph">Here’s a step-by-step guide for getting started with Meteor:</p>



<h4 class="wp-block-heading"><strong>Step 1: Install Meteor</strong></h4>



<p class="wp-block-paragraph">Start by installing Meteor on your machine. Meteor can be installed via a simple command in the terminal:</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
curl https://install.meteor.com/ | sh

</pre></div>


<h4 class="wp-block-heading"><strong>Step 2: Create a New Meteor Project</strong></h4>



<p class="wp-block-paragraph">Once Meteor is installed, you can create a new Meteor project using the following command:</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
meteor create myapp

</pre></div>


<p class="wp-block-paragraph">This creates a new directory (<code>myapp</code>) with the basic structure of a Meteor app.</p>



<h4 class="wp-block-heading"><strong>Step 3: Run Your Application</strong></h4>



<p class="wp-block-paragraph">Navigate into the newly created app directory and run the application:</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
cd myapp
meteor

</pre></div>


<p class="wp-block-paragraph">Your app should now be running on <code>http://localhost:3000</code>.</p>



<h4 class="wp-block-heading"><strong>Step 4: Define Collections</strong></h4>



<p class="wp-block-paragraph">Meteor uses collections to store data. You can define a collection on both the client and server.</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
// In a file named collections.js
import { Mongo } from &#039;meteor/mongo&#039;;

export const Tasks = new Mongo.Collection(&#039;tasks&#039;);

</pre></div>


<h4 class="wp-block-heading"><strong>Step 5: Define Publications and Subscriptions</strong></h4>



<p class="wp-block-paragraph">On the server, create a publication that sends data to the client. On the client, subscribe to this data.</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
// On the server (in server/main.js)
import { Meteor } from &#039;meteor/meteor&#039;;
import { Tasks } from &#039;/imports/collections&#039;;

Meteor.publish(&#039;tasks&#039;, function() {
  return Tasks.find();
});

// On the client (in client/main.js)
import { Meteor } from &#039;meteor/meteor&#039;;
import { Tasks } from &#039;/imports/collections&#039;;

Meteor.subscribe(&#039;tasks&#039;);

</pre></div>


<h4 class="wp-block-heading"><strong>Step 6: Display Data in the UI</strong></h4>



<p class="wp-block-paragraph">Use templates to display data from collections. For example:</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
&amp;lt;!-- In the HTML file (client/main.html) --&amp;gt;
&amp;lt;template name=&quot;taskList&quot;&amp;gt;
  &amp;lt;ul&amp;gt;
    {{#each tasks}}
      &amp;lt;li&amp;gt;{{name}}&amp;lt;/li&amp;gt;
    {{/each}}
  &amp;lt;/ul&amp;gt;
&amp;lt;/template&amp;gt;

</pre></div>


<h4 class="wp-block-heading"><strong>Step 7: Modify Data on the Server</strong></h4>



<p class="wp-block-paragraph">To add or modify data, you can use Meteor’s simple API to interact with collections.</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
// On the server
Meteor.methods({
  &#039;tasks.insert&#039;(name) {
    Tasks.insert({ name });
  },
});

</pre></div><p>The post <a href="https://www.scmgalaxy.com/tutorials/mastering-meteor-use-cases-architecture-workflow-and-getting-started/">Mastering Meteor: Use Cases, Architecture, Workflow, and Getting Started</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.scmgalaxy.com/tutorials/mastering-meteor-use-cases-architecture-workflow-and-getting-started/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Mastering Mongoose: A Developer’s Guide to MongoDB Modeling</title>
		<link>https://www.scmgalaxy.com/tutorials/mastering-mongoose-a-developers-guide-to-mongodb-modeling/</link>
					<comments>https://www.scmgalaxy.com/tutorials/mastering-mongoose-a-developers-guide-to-mongodb-modeling/#respond</comments>
		
		<dc:creator><![CDATA[Vijay K]]></dc:creator>
		<pubDate>Mon, 26 May 2025 06:47:31 +0000</pubDate>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[BackendDevelopment]]></category>
		<category><![CDATA[DataModeling]]></category>
		<category><![CDATA[ExpressJS]]></category>
		<category><![CDATA[MongoDB]]></category>
		<category><![CDATA[MongooseGuide]]></category>
		<category><![CDATA[MongooseJS]]></category>
		<category><![CDATA[nodejs]]></category>
		<category><![CDATA[NoSQL]]></category>
		<guid isPermaLink="false">https://www.scmgalaxy.com/tutorials/?p=12409</guid>

					<description><![CDATA[<p>What is Mongoose? Mongoose is an elegant, robust Object Data Modeling (ODM) library for MongoDB and Node.js. It provides developers [&#8230;]</p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/mastering-mongoose-a-developers-guide-to-mongodb-modeling/">Mastering Mongoose: A Developer’s Guide to MongoDB Modeling</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<figure class="wp-block-image size-large"><img decoding="async" width="1024" height="576" src="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2025/05/image-97-1024x576.png" alt="" class="wp-image-12416" srcset="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2025/05/image-97-1024x576.png 1024w, https://www.scmgalaxy.com/tutorials/wp-content/uploads/2025/05/image-97-300x169.png 300w, https://www.scmgalaxy.com/tutorials/wp-content/uploads/2025/05/image-97-768x432.png 768w, https://www.scmgalaxy.com/tutorials/wp-content/uploads/2025/05/image-97.png 1400w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<hr class="wp-block-separator has-alpha-channel-opacity">



<h2 class="wp-block-heading"><strong>What is Mongoose?</strong></h2>



<p class="wp-block-paragraph"><strong>Mongoose</strong> is an elegant, robust <strong>Object Data Modeling (ODM)</strong> library for <strong>MongoDB</strong> and <strong>Node.js</strong>. It provides developers with powerful tools to interact with MongoDB using object-oriented paradigms and schema-based data modeling. While MongoDB natively stores data in a schema-less, JSON-like format (BSON), Mongoose allows you to impose schemas on your data models, enforce validations, and build complex queries effortlessly.</p>



<p class="wp-block-paragraph">Mongoose enhances developer productivity and data reliability through:</p>



<ul class="wp-block-list">
<li>Schema validation and enforcement</li>



<li>Built-in data type casting</li>



<li>Middleware support (pre/post hooks)</li>



<li>Plugin ecosystem</li>



<li>Built-in query building and population</li>
</ul>



<p class="wp-block-paragraph">Whether you’re building RESTful APIs, real-time applications, or complex enterprise systems, Mongoose bridges the flexibility of NoSQL with the discipline of structured programming.</p>



<hr class="wp-block-separator has-alpha-channel-opacity">



<h2 class="wp-block-heading"><strong>Major Use Cases of Mongoose</strong></h2>



<p class="wp-block-paragraph">Mongoose is incredibly versatile and is commonly used in the following development scenarios:</p>



<h3 class="wp-block-heading">1. <strong>Structured Backend for Node.js Applications</strong></h3>



<p class="wp-block-paragraph">In applications where data structure consistency is essential (e.g., e-commerce platforms, content management systems), Mongoose ensures schema enforcement on MongoDB documents.</p>



<h3 class="wp-block-heading">2. <strong>CRUD API Development</strong></h3>



<p class="wp-block-paragraph">Mongoose pairs seamlessly with <strong>Express.js</strong> to handle <strong>Create</strong>, <strong>Read</strong>, <strong>Update</strong>, and <strong>Delete</strong> operations. Its syntax simplifies working with MongoDB queries in a readable, chainable format.</p>



<h3 class="wp-block-heading">3. <strong>Form Validation</strong></h3>



<p class="wp-block-paragraph">User input from forms can be validated using Mongoose&#8217;s schema-level validations, such as:</p>



<ul class="wp-block-list">
<li>Required fields</li>



<li>Min/max value limits</li>



<li>Regex pattern matching</li>



<li>Custom validation functions</li>
</ul>



<h3 class="wp-block-heading">4. <strong>Modeling Relationships</strong></h3>



<p class="wp-block-paragraph">Although MongoDB is document-oriented and not relational, Mongoose allows you to <strong>reference documents</strong> across collections using <code>ObjectId</code> and the <code>populate()</code> method, enabling SQL-like data joins.</p>



<h3 class="wp-block-heading">5. <strong>Plugins and Middleware</strong></h3>



<p class="wp-block-paragraph">Use or create <strong>plugins</strong> like pagination, timestamps, soft delete, etc. Middleware (hooks) like <code>pre('save')</code> or <code>post('find')</code> make it easy to inject custom logic at lifecycle events.</p>



<h3 class="wp-block-heading">6. <strong>Rapid Prototyping</strong></h3>



<p class="wp-block-paragraph">For startups and hackathons, Mongoose’s ease of use and flexibility make it a top choice for quickly building and iterating full-stack applications with MongoDB.</p>



<hr class="wp-block-separator has-alpha-channel-opacity">



<h2 class="wp-block-heading"><strong>How Mongoose Works (with Architecture)</strong></h2>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="800" height="390" src="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2025/05/image-98.png" alt="" class="wp-image-12417" srcset="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2025/05/image-98.png 800w, https://www.scmgalaxy.com/tutorials/wp-content/uploads/2025/05/image-98-300x146.png 300w, https://www.scmgalaxy.com/tutorials/wp-content/uploads/2025/05/image-98-768x374.png 768w" sizes="auto, (max-width: 800px) 100vw, 800px" /></figure>



<p class="wp-block-paragraph">At a high level, Mongoose sits between the <strong>Node.js server application</strong> and the <strong>MongoDB database</strong>, offering a structured interface to interact with otherwise schemaless data.</p>



<h3 class="wp-block-heading"><strong>Architecture and Flow:</strong></h3>



<h4 class="wp-block-heading">1. <strong>MongoDB Connection Layer</strong></h4>



<p class="wp-block-paragraph">Mongoose establishes a connection to a MongoDB database using a connection URI. The connection is managed via <code>mongoose.connect()</code>.</p>



<h4 class="wp-block-heading">2. <strong>Schema Definition Layer</strong></h4>



<p class="wp-block-paragraph">A schema defines the structure and rules of documents in a collection:</p>



<ul class="wp-block-list">
<li>Field types (String, Number, Date, etc.)</li>



<li>Constraints (required, unique)</li>



<li>Defaults</li>



<li>Getters/setters</li>



<li>Custom validators</li>
</ul>



<h4 class="wp-block-heading">3. <strong>Model Layer</strong></h4>



<p class="wp-block-paragraph">Schemas are compiled into <strong>models</strong>, which act as constructors and query interfaces for MongoDB collections. They expose methods like <code>.find()</code>, <code>.save()</code>, <code>.updateOne()</code>, etc.</p>



<h4 class="wp-block-heading">4. <strong>Middleware and Hooks</strong></h4>



<p class="wp-block-paragraph">Developers can register middleware to run logic <strong>before or after</strong> operations:</p>



<ul class="wp-block-list">
<li>Pre-save: Hash passwords before saving</li>



<li>Post-remove: Cleanup references or logs</li>



<li>Pre-find: Auto-populate fields</li>
</ul>



<h4 class="wp-block-heading">5. <strong>Plugins and Ecosystem</strong></h4>



<p class="wp-block-paragraph">Mongoose has a rich plugin ecosystem allowing reuse of functionality like:</p>



<ul class="wp-block-list">
<li>Auto-timestamps</li>



<li>Authentication (e.g., via <code>passport-local-mongoose</code>)</li>



<li>Slug generation</li>



<li>Virtual fields</li>
</ul>



<hr class="wp-block-separator has-alpha-channel-opacity">



<h2 class="wp-block-heading"><strong>Basic Workflow of Mongoose</strong></h2>



<p class="wp-block-paragraph">Here is the typical workflow for using Mongoose in a Node.js project:</p>



<h3 class="wp-block-heading"><strong>1. Connect to the Database</strong></h3>



<p class="wp-block-paragraph">Establish a connection to MongoDB using Mongoose.</p>



<h3 class="wp-block-heading"><strong>2. Define a Schema</strong></h3>



<p class="wp-block-paragraph">Create a schema that outlines your data structure and includes validations and defaults.</p>



<h3 class="wp-block-heading"><strong>3. Create a Model</strong></h3>



<p class="wp-block-paragraph">Compile the schema into a model using <code>mongoose.model()</code>.</p>



<h3 class="wp-block-heading"><strong>4. Use the Model to Interact with Data</strong></h3>



<p class="wp-block-paragraph">Leverage methods like <code>.create()</code>, <code>.find()</code>, <code>.findById()</code>, <code>.updateOne()</code>, and <code>.deleteOne()</code> to manipulate data.</p>



<h3 class="wp-block-heading"><strong>5. Handle Middleware</strong></h3>



<p class="wp-block-paragraph">Add hooks for additional logic at specific stages of data processing.</p>



<h3 class="wp-block-heading"><strong>6. Scale with Plugins</strong></h3>



<p class="wp-block-paragraph">Add reusable plugins for features like pagination, auditing, and authorization.</p>



<hr class="wp-block-separator has-alpha-channel-opacity">



<h2 class="wp-block-heading"><strong>Step-by-Step Getting Started Guide for Mongoose</strong></h2>



<p class="wp-block-paragraph">Here’s a comprehensive walkthrough to help you start using Mongoose with MongoDB and Node.js:</p>



<hr class="wp-block-separator has-alpha-channel-opacity">



<h3 class="wp-block-heading"><strong>Step 1: Install Node.js and MongoDB</strong></h3>



<p class="wp-block-paragraph">Ensure you have Node.js and MongoDB installed on your system. You can use MongoDB locally or connect to a cloud instance (like <a href="https://www.mongodb.com/cloud/atlas">MongoDB Atlas</a>).</p>



<hr class="wp-block-separator has-alpha-channel-opacity">



<h3 class="wp-block-heading"><strong>Step 2: Initialize a Node.js Project</strong></h3>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
mkdir mongoose-demo &amp;amp;&amp;amp; cd mongoose-demo
npm init -y
npm install mongoose express

</pre></div>


<hr class="wp-block-separator has-alpha-channel-opacity">



<h3 class="wp-block-heading"><strong>Step 3: Connect Mongoose to MongoDB</strong></h3>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
// db.js
const mongoose = require(&#039;mongoose&#039;);

mongoose.connect(&#039;mongodb://localhost:27017/mongoose_demo&#039;, {
  useNewUrlParser: true,
  useUnifiedTopology: true,
}).then(() =&amp;gt; {
  console.log(&quot;MongoDB Connected&quot;);
}).catch(err =&amp;gt; console.error(err));

</pre></div>


<hr class="wp-block-separator has-alpha-channel-opacity">



<h3 class="wp-block-heading"><strong>Step 4: Define a Schema and Model</strong></h3>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
// models/User.js
const mongoose = require(&#039;mongoose&#039;);

const userSchema = new mongoose.Schema({
  name: { type: String, required: true },
  email: { type: String, required: true, unique: true },
  age: { type: Number, min: 0 },
}, { timestamps: true });

module.exports = mongoose.model(&#039;User&#039;, userSchema);

</pre></div>


<hr class="wp-block-separator has-alpha-channel-opacity">



<h3 class="wp-block-heading"><strong>Step 5: Perform CRUD Operations</strong></h3>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
// app.js
const express = require(&#039;express&#039;);
const mongoose = require(&#039;./db&#039;);
const User = require(&#039;./models/User&#039;);
const app = express();

app.use(express.json());

// Create
app.post(&#039;/users&#039;, async (req, res) =&amp;gt; {
  try {
    const user = await User.create(req.body);
    res.json(user);
  } catch (err) {
    res.status(400).json({ error: err.message });
  }
});

// Read
app.get(&#039;/users&#039;, async (req, res) =&amp;gt; {
  const users = await User.find();
  res.json(users);
});

// Update
app.put(&#039;/users/:id&#039;, async (req, res) =&amp;gt; {
  const user = await User.findByIdAndUpdate(req.params.id, req.body, { new: true });
  res.json(user);
});

// Delete
app.delete(&#039;/users/:id&#039;, async (req, res) =&amp;gt; {
  await User.findByIdAndDelete(req.params.id);
  res.json({ message: &#039;User deleted&#039; });
});

app.listen(3000, () =&amp;gt; console.log(&#039;Server running on port 3000&#039;));

</pre></div>


<hr class="wp-block-separator has-alpha-channel-opacity">



<h3 class="wp-block-heading"><strong>Step 6: Add Middleware Example (Hash Password)</strong></h3>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
const bcrypt = require(&#039;bcrypt&#039;);

userSchema.pre(&#039;save&#039;, async function (next) {
  if (this.isModified(&#039;password&#039;)) {
    this.password = await bcrypt.hash(this.password, 10);
  }
  next();
});

</pre></div>


<hr class="wp-block-separator has-alpha-channel-opacity">



<h3 class="wp-block-heading"><strong>Step 7: Try It Out</strong></h3>



<p class="wp-block-paragraph">Run your server:</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
node app.js

</pre></div>


<p class="wp-block-paragraph">Test with a tool like <strong>Postman</strong> or <strong>cURL</strong>:</p>



<ul class="wp-block-list">
<li><code>POST /users</code> → Create a user</li>



<li><code>GET /users</code> → Get all users</li>



<li><code>PUT /users/:id</code> → Update user</li>



<li><code>DELETE /users/:id</code> → Delete user</li>
</ul>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/mastering-mongoose-a-developers-guide-to-mongodb-modeling/">Mastering Mongoose: A Developer’s Guide to MongoDB Modeling</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.scmgalaxy.com/tutorials/mastering-mongoose-a-developers-guide-to-mongodb-modeling/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Getting Started with Express.js: The Fast and Minimalist Web Framework</title>
		<link>https://www.scmgalaxy.com/tutorials/getting-started-with-express-js-the-fast-and-minimalist-web-framework/</link>
					<comments>https://www.scmgalaxy.com/tutorials/getting-started-with-express-js-the-fast-and-minimalist-web-framework/#respond</comments>
		
		<dc:creator><![CDATA[Vijay K]]></dc:creator>
		<pubDate>Tue, 13 May 2025 08:01:20 +0000</pubDate>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[APIDevelopment]]></category>
		<category><![CDATA[BackendDevelopment]]></category>
		<category><![CDATA[ExpressGuide]]></category>
		<category><![CDATA[ExpressJS]]></category>
		<category><![CDATA[nodejs]]></category>
		<category><![CDATA[WebDevelopment]]></category>
		<category><![CDATA[WebFrameworks]]></category>
		<guid isPermaLink="false">https://www.scmgalaxy.com/tutorials/?p=12295</guid>

					<description><![CDATA[<p>What is Express.js? Express.js, commonly referred to as Express, is a fast, unopinionated, and minimalist web framework for Node.js. It [&#8230;]</p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/getting-started-with-express-js-the-fast-and-minimalist-web-framework/">Getting Started with Express.js: The Fast and Minimalist Web Framework</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="335" src="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2025/05/image-40-1024x335.png" alt="" class="wp-image-12299" srcset="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2025/05/image-40-1024x335.png 1024w, https://www.scmgalaxy.com/tutorials/wp-content/uploads/2025/05/image-40-300x98.png 300w, https://www.scmgalaxy.com/tutorials/wp-content/uploads/2025/05/image-40-768x251.png 768w, https://www.scmgalaxy.com/tutorials/wp-content/uploads/2025/05/image-40.png 1302w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<hr class="wp-block-separator has-alpha-channel-opacity">



<h3 class="wp-block-heading">What is Express.js?</h3>



<p class="wp-block-paragraph">Express.js, commonly referred to as Express, is a fast, unopinionated, and minimalist web framework for Node.js. It simplifies the process of building web applications and APIs by providing a robust set of features, such as routing, middleware support, template rendering, and much more. Express is one of the most popular and widely used frameworks in the Node.js ecosystem because it enhances the core capabilities of Node.js by making the web application development process more efficient and organized.</p>



<p class="wp-block-paragraph">Express.js works on top of Node.js, utilizing the non-blocking, event-driven nature of Node.js for handling asynchronous requests. By offering a minimalistic yet highly extensible structure, Express allows developers to create scalable and high-performance web applications. Express is particularly well-suited for building APIs, handling HTTP requests and responses, and managing the back-end of web applications.</p>



<p class="wp-block-paragraph">Some key features of Express.js include:</p>



<ul class="wp-block-list">
<li><strong>Routing</strong>: It provides an elegant and powerful way to define routes for handling different HTTP requests (GET, POST, PUT, DELETE).</li>



<li><strong>Middleware</strong>: Express allows you to add custom functions to handle requests before the route handler is called, allowing for things like authentication, logging, and error handling.</li>



<li><strong>Templating</strong>: Express supports various templating engines (like Pug, EJS, and Handlebars) for rendering dynamic content.</li>



<li><strong>Static Files</strong>: It can serve static files, such as images, CSS, and JavaScript, directly from the server.</li>



<li><strong>Extensibility</strong>: Express is lightweight, and developers can extend its functionality using middleware or plugins to fit their needs.</li>
</ul>



<p class="wp-block-paragraph">Express.js is an essential tool for developers working with Node.js, especially for building RESTful APIs, single-page applications, and server-side rendered websites.</p>



<hr class="wp-block-separator has-alpha-channel-opacity">



<h3 class="wp-block-heading">What are the Major Use Cases of Express.js?</h3>



<p class="wp-block-paragraph">Express.js is a versatile framework used in various web application and API development scenarios. Some of the major use cases include:</p>



<ol class="wp-block-list">
<li><strong>Building RESTful APIs</strong>:<br>Express.js is widely used for developing RESTful APIs. Its straightforward routing system and support for JSON responses make it ideal for handling API requests and interacting with databases. You can use Express to easily create endpoints for CRUD operations (Create, Read, Update, Delete).</li>



<li><strong>Web Application Development</strong>:<br>Express is perfect for building traditional web applications that need a backend to serve HTML, CSS, and JavaScript files. The framework also supports templating engines, which allows dynamic content to be rendered on the server and sent to the client.</li>



<li><strong>Single Page Applications (SPA)</strong>:<br>Express.js can be used to serve data and handle requests for single-page applications. By integrating Express with front-end frameworks like React, Vue, or Angular, you can create dynamic user interfaces with API-driven backends.</li>



<li><strong>Middleware for Handling Requests</strong>:<br>Express excels in handling middleware, which are functions that process requests before they reach the route handlers. Middleware functions can handle tasks such as logging, authentication, request validation, and error handling. This makes Express particularly useful in creating modular and scalable server-side architectures.</li>



<li><strong>Real-Time Web Applications</strong>:<br>Express can be used in conjunction with WebSocket libraries (like Socket.io) to develop real-time applications like chat apps, notification systems, or live data dashboards, allowing clients and servers to communicate instantly.</li>



<li><strong>Server-Side Rendering (SSR)</strong>:<br>Express.js is frequently used for server-side rendering (SSR) applications. By utilizing templating engines such as Pug or EJS, developers can render HTML on the server before sending it to the browser, improving SEO and reducing initial load time.</li>



<li><strong>Microservices</strong>:<br>Express is lightweight and modular, making it an excellent choice for building microservices. Developers can create individual microservices, each responsible for specific functionality, and then use Express to build APIs to facilitate communication between them.</li>
</ol>



<hr class="wp-block-separator has-alpha-channel-opacity">



<h3 class="wp-block-heading">How Express.js Works Along with Architecture?</h3>



<figure class="wp-block-image size-full is-resized"><img loading="lazy" decoding="async" width="800" height="400" src="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2025/05/image-42.png" alt="" class="wp-image-12302" style="width:840px;height:auto" srcset="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2025/05/image-42.png 800w, https://www.scmgalaxy.com/tutorials/wp-content/uploads/2025/05/image-42-300x150.png 300w, https://www.scmgalaxy.com/tutorials/wp-content/uploads/2025/05/image-42-768x384.png 768w" sizes="auto, (max-width: 800px) 100vw, 800px" /></figure>



<p class="wp-block-paragraph">Express.js follows the typical architecture of a web application built with Node.js but adds an additional layer of routing and middleware functionality to simplify the development process.</p>



<h4 class="wp-block-heading">Basic Architecture of Express.js</h4>



<ol class="wp-block-list">
<li><strong>Request Handling</strong>: Express handles HTTP requests by defining routes and associating them with specific HTTP methods (GET, POST, PUT, DELETE). When a request is made to the server, Express will evaluate the incoming request and match it to the appropriate route.</li>



<li><strong>Routing</strong>: The routing system in Express is at the heart of its architecture. Routes are defined to handle specific HTTP requests, and each route can be linked to one or more middleware functions. Routes define the logic that processes the request and sends back the response to the client.</li>



<li><strong>Middleware</strong>: Middleware functions are a central component of Express applications. They sit between the request and the response, allowing you to add functionality to requests before they reach the route handler. Middleware can handle authentication, logging, input validation, or simply pass control to the next middleware or route handler. Middleware functions can be global or route-specific.</li>



<li><strong>Server and Listener</strong>: Express creates an HTTP server that listens for incoming requests on a specified port. The server is created using the <code>express()</code> function, and the listener is started using the <code>app.listen()</code> method.</li>



<li><strong>Request-Response Cycle</strong>: The cycle begins when a client sends an HTTP request to the server. The server processes the request, executes the relevant route handler, and responds to the client with data (usually in JSON format) or HTML.</li>



<li><strong>Template Rendering</strong>: If the application uses server-side rendering (SSR), Express uses templating engines to render HTML on the server. The engine compiles dynamic data into an HTML template, which is then sent to the client.</li>



<li><strong>Static File Serving</strong>: Express can serve static assets like images, stylesheets, and JavaScript files directly using the <code>express.static()</code> middleware, improving performance by offloading static content from the application logic.</li>
</ol>



<hr class="wp-block-separator has-alpha-channel-opacity">



<h3 class="wp-block-heading">What are the Basic Workflows of Express.js?</h3>



<p class="wp-block-paragraph">The workflow in an Express.js application typically follows these steps:</p>



<ol class="wp-block-list">
<li><strong>Initialization</strong>:
<ul class="wp-block-list">
<li>First, you initialize an Express application by importing the <code>express</code> module and creating an app instance.</li>



<li>You then configure any middleware (for handling requests) and routes (for handling specific HTTP requests).</li>
</ul>
</li>



<li><strong>Routing and Middleware Handling</strong>:
<ul class="wp-block-list">
<li>When a request is made to the server, Express evaluates the URL and HTTP method, matching the request to the appropriate route.</li>



<li>Middleware functions are executed before the route handler, allowing for pre-processing tasks (e.g., authentication, logging, or data validation).</li>



<li>Once the middleware completes its work, the request reaches the relevant route handler.</li>
</ul>
</li>



<li><strong>Request Processing</strong>:
<ul class="wp-block-list">
<li>In the route handler, the application processes the request (e.g., querying a database, applying business logic, or rendering a page) and sends back a response.</li>



<li>If the route is designed to handle an API request, the response might include JSON data.</li>
</ul>
</li>



<li><strong>Response</strong>:
<ul class="wp-block-list">
<li>The server sends the response back to the client. This could include rendered HTML pages, JSON data, or status messages.</li>



<li>Express also supports sending status codes, headers, and other information as part of the response.</li>
</ul>
</li>



<li><strong>Error Handling</strong>:
<ul class="wp-block-list">
<li>If an error occurs, Express provides a centralized way to handle errors using middleware. This ensures that your application can gracefully handle failures and provide useful feedback to the client.</li>
</ul>
</li>
</ol>



<hr class="wp-block-separator has-alpha-channel-opacity">



<h3 class="wp-block-heading">Step-by-Step Getting Started Guide for Express.js</h3>



<ol class="wp-block-list">
<li><strong>Install Node.js</strong>:
<ul class="wp-block-list">
<li>Before you can use Express.js, you need to install Node.js on your machine. You can download and install it from <a href="https://nodejs.org/">nodejs.org</a>.</li>
</ul>
</li>



<li><strong>Set Up a New Project</strong>:
<ul class="wp-block-list">
<li>Create a new directory for your project and navigate to it in your terminal.</li>



<li>Initialize a new Node.js project by running the command: <code>npm init -y</code></li>
</ul>
</li>



<li><strong>Install Express.js</strong>:
<ul class="wp-block-list">
<li>Use npm (Node Package Manager) to install Express.js: <code>npm install express</code></li>
</ul>
</li>



<li><strong>Create Your First Express Application</strong>:
<ul class="wp-block-list">
<li>In your project directory, create a new file named <code>app.js</code> and write the following code: <code>const express = require('express'); const app = express(); const port = 3000; // Basic route app.get('/', (req, res) =&gt; { res.send('Hello World!'); }); app.listen(port, () =&gt; { console.log(`App is listening at http://localhost:${port}`); });</code></li>
</ul>
</li>



<li><strong>Run Your Application</strong>:
<ul class="wp-block-list">
<li>Start your application by running the following command in the terminal: <code>node app.js</code></li>
</ul>
</li>



<li><strong>Test the Application</strong>:
<ul class="wp-block-list">
<li>Open a web browser and navigate to <code>http://localhost:3000</code>. You should see &#8220;Hello World!&#8221; displayed in your browser.</li>
</ul>
</li>



<li><strong>Expand the Application</strong>:
<ul class="wp-block-list">
<li>You can add more routes, middleware, and even integrate a database like MongoDB or MySQL to expand the functionality of your application.</li>
</ul>
</li>
</ol>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/getting-started-with-express-js-the-fast-and-minimalist-web-framework/">Getting Started with Express.js: The Fast and Minimalist Web Framework</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.scmgalaxy.com/tutorials/getting-started-with-express-js-the-fast-and-minimalist-web-framework/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Modifying Text Nodes in JavaScript</title>
		<link>https://www.scmgalaxy.com/tutorials/modifying-text-nodes-in-javascript/</link>
					<comments>https://www.scmgalaxy.com/tutorials/modifying-text-nodes-in-javascript/#respond</comments>
		
		<dc:creator><![CDATA[rajeshkumar]]></dc:creator>
		<pubDate>Mon, 09 Aug 2021 07:48:15 +0000</pubDate>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[nodejs]]></category>
		<category><![CDATA[String]]></category>
		<guid isPermaLink="false">https://www.scmgalaxy.com/tutorials/?p=7610</guid>

					<description><![CDATA[<p>Properties Data Length Methods appendData(String) deleteData(start, length) insertData(start, string) replaceData(start, length, string) splitText(start) substringData(start, length) Length Length property is used [&#8230;]</p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/modifying-text-nodes-in-javascript/">Modifying Text Nodes in JavaScript</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<h2 class="wp-block-heading"><strong>Properties</strong></h2>



<ul class="wp-block-list"><li><strong>Data</strong></li><li><strong>Length</strong></li></ul>



<h2 class="wp-block-heading"><strong>Methods</strong></h2>



<ul class="wp-block-list"><li><strong>appendData(String)</strong></li><li><strong>deleteData(start, length)</strong></li><li><strong>insertData(start, string)</strong></li><li><strong>replaceData(start, length, string)</strong></li><li><strong>splitText(start)</strong></li><li><strong>substringData(start, length)</strong></li></ul>



<h2 class="wp-block-heading"><strong>Length</strong></h2>



<p class="wp-block-paragraph">Length property is used to access the length of Text which indicates the number of characters it contains.</p>



<p class="wp-block-paragraph">Syntax:-   TextNode.length</p>



<h2 class="wp-block-heading"><strong>Data</strong></h2>



<p class="wp-block-paragraph">Data property is used to set or return the value of a text node and comment node objects.</p>



<p class="wp-block-paragraph"><strong>Syntax: &#8211;</strong><br><strong>Sets</strong><br>TextNode.data = value<br><strong>Returns</strong><br>TextNode.data</p>



<p class="wp-block-paragraph"><strong>Ex:-</strong> TextNode.data = “Hello DevOpsSchool”;</p>



<h2 class="wp-block-heading"><strong>appendData(String)</strong></h2>



<p class="wp-block-paragraph">This method is used to append the passed string to the end of the text node and comment node.</p>



<p class="wp-block-paragraph"><strong>Syntax: &#8211;</strong><br>TextNode.appendData(String);</p>



<p class="wp-block-paragraph"><strong>Ex: &#8211;</strong><br>TextNode.appendData(“Hello DevOpsSchool”);</p>



<h2 class="wp-block-heading"><strong>deleteData(start, length)</strong></h2>



<p class="wp-block-paragraph">This method is used to delete or remove text content from a text node and comment node. It deletes the specified <em>length</em> of characters starting from index defined in <em>start</em>.</p>



<p class="wp-block-paragraph"><strong>Syntax:-</strong><br>TextNode.deleteData(start, length);</p>



<p class="wp-block-paragraph"><strong>Ex: &#8211;</strong><br>TextNode.deleteData(0, 5);</p>



<h2 class="wp-block-heading"><strong>insertData(start, string)</strong></h2>



<p class="wp-block-paragraph">This method is used to insert text content to text node and comment node. It inserts the value in <em>string</em>, starting at the character index specified in <em>start</em>.</p>



<p class="wp-block-paragraph"><strong>Syntax:-</strong><br>TextNode.insertData(start, string)</p>



<p class="wp-block-paragraph"><strong>Ex: &#8211;</strong><br>TextNode.insertData(3, “Hello”)</p>



<h2 class="wp-block-heading"><strong>replaceData(start, length, string)</strong></h2>



<p class="wp-block-paragraph">This method is used to replace text content of text node and comment node. It inserts the value in <em>string</em>, starting at the character index specified in <em>start</em>.</p>



<p class="wp-block-paragraph"><strong>Syntax:-</strong><br>TextNode.replaceData(start, length, string)</p>



<p class="wp-block-paragraph"><strong>Ex: &#8211;</strong><br>TextNode.replaceData(0, 4, “Hello”)</p>



<h2 class="wp-block-heading"><strong>splitText(start)</strong></h2>



<p class="wp-block-paragraph">The splitText(start) method breaks the Text node into two nodes at the specified <em>start</em> index, keeping both nodes in the tree as siblings. It returns right side of the split in a new text node and leaves the left side in the original.</p>



<p class="wp-block-paragraph"><strong>Syntax: &#8211;</strong><br>var rightSide = TextNode.splitText(start)</p>



<p class="wp-block-paragraph"><strong>Ex: &#8211;</strong><br>var rightSide = TextNode.splitText(5)</p>



<h2 class="wp-block-heading"><strong>substringData(start, length)</strong></h2>



<p class="wp-block-paragraph">It returns the part of the current element&#8217;s (TextNode and CommentNode) text content from the specified position with the specified length.</p>



<p class="wp-block-paragraph"><strong>Syntax:-</strong><br>TextNode.substringData(start, length)</p>



<p class="wp-block-paragraph"><strong>Ex: &#8211;</strong><br>TextNode.substringData(2, 5);</p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/modifying-text-nodes-in-javascript/">Modifying Text Nodes in JavaScript</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.scmgalaxy.com/tutorials/modifying-text-nodes-in-javascript/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>error in ./resources/assets/sass/app.scss</title>
		<link>https://www.scmgalaxy.com/tutorials/error-in-resources-assets-sass-app-scss/</link>
					<comments>https://www.scmgalaxy.com/tutorials/error-in-resources-assets-sass-app-scss/#respond</comments>
		
		<dc:creator><![CDATA[Ashwani Kumar]]></dc:creator>
		<pubDate>Sat, 07 Aug 2021 12:05:32 +0000</pubDate>
				<category><![CDATA[Node js]]></category>
		<category><![CDATA[dart-sass]]></category>
		<category><![CDATA[error in ./resources/assets/sass/app.scss]]></category>
		<category><![CDATA[Node]]></category>
		<category><![CDATA[node-sass]]></category>
		<category><![CDATA[node-sass not found]]></category>
		<category><![CDATA[nodejs]]></category>
		<category><![CDATA[not found]]></category>
		<category><![CDATA[npm]]></category>
		<category><![CDATA[npm err!]]></category>
		<category><![CDATA[NPM error]]></category>
		<category><![CDATA[npm run development]]></category>
		<guid isPermaLink="false">https://www.scmgalaxy.com/tutorials/?p=7586</guid>

					<description><![CDATA[<p>If you are getting this error (error in ./resources/assets/sass/app.scss) in Node module please follow some steps which is have mentioned [&#8230;]</p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/error-in-resources-assets-sass-app-scss/">error in ./resources/assets/sass/app.scss</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">If you are getting this error (error in ./resources/assets/sass/app.scss) in Node module please follow some steps which is have mentioned in the following</p>



<h4 class="wp-block-heading">Error:-</h4>



<p class="wp-block-paragraph">Many of you get this error when you did not change anything in <code>app.scss</code>, but when I run <code>npm run watch</code> I get the following errors:</p>



<pre class="wp-block-code"><code><span class="has-inline-color has-vivid-cyan-blue-color"> error  in ./resources/sass/app.scss                                                                      

Module build failed (from ./node_modules/sass-loader/lib/loader.js):                                      
Unsupported operation: Cannot extract a file path from a URI with a fragment component                    

@ ./resources/sass/app.scss 2:14-254                                                                     

    Asset      Size   Chunks             Chunk Names                                                     
/js/app.js  2.46 MiB  /js/app  &#91;emitted]  /js/app                                                         

ERROR in ./resources/sass/app.scss                                                                        
Module build failed (from ./node_modules/css-loader/index.js):                                            
ModuleBuildError: Module build failed (from ./node_modules/sass-loader/lib/loader.js):                    

undefined                                                                                                 
      ^                                                                                                  
      Join(null, "variables"): part 0 was null, but part 1 was not.                                       
@import 'variables';                                                                                      
        ^^^^^^^^^^^                                                                                       
  stdin 2:9  root stylesheet                                                                              
      in C:\Users\TAQI VAHEED\Desktop\#Coding\resPro\resources\sass\app.scss (line 2, column 9)           
    at runLoaders (C:\Users\TAQI VAHEED\Desktop\#Coding\resPro\node_modules\webpack\lib\NormalModule.js:30
    at C:\Users\TAQI VAHEED\Desktop\#Coding\resPro\node_modules\loader-runner\lib\LoaderRunner.js:364:11  
    at C:\Users\TAQI VAHEED\Desktop\#Coding\resPro\node_modules\loader-runner\lib\LoaderRunner.js:230:18  
    at context.callback (C:\Users\TAQI VAHEED\Desktop\#Coding\resPro\node_modules\loader-runner\lib\Loader
13)</span></code></pre>



<h4 class="wp-block-heading">Solution:-</h4>



<p class="wp-block-paragraph">The main issue which we have found that is related to<code><span class="has-inline-color has-vivid-red-color"> dart-sass</span></code> being used instead of <code><span class="has-inline-color has-vivid-red-color">node-sass</span></code> with <code>laravel</code></p>



<p class="wp-block-paragraph">You have to just follow one step:-</p>



<p class="wp-block-paragraph"><strong>Step 1:-</strong> You have to run this Command and all the things will solve .</p>



<pre class="wp-block-code"><code><span class="has-inline-color has-vivid-red-color">npm install node-sass</span></code></pre>



<p class="wp-block-paragraph"></p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/error-in-resources-assets-sass-app-scss/">error in ./resources/assets/sass/app.scss</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.scmgalaxy.com/tutorials/error-in-resources-assets-sass-app-scss/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>&#8216;cross-env&#8217; is not recognized as an internal or external command, operable program or batch file.</title>
		<link>https://www.scmgalaxy.com/tutorials/cross-env-is-not-recognized-as-an-internal-or-external-command-operable-program-or-batch-file/</link>
					<comments>https://www.scmgalaxy.com/tutorials/cross-env-is-not-recognized-as-an-internal-or-external-command-operable-program-or-batch-file/#respond</comments>
		
		<dc:creator><![CDATA[Ashwani Kumar]]></dc:creator>
		<pubDate>Sat, 07 Aug 2021 11:48:32 +0000</pubDate>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[cross-env]]></category>
		<category><![CDATA[Node]]></category>
		<category><![CDATA[node error]]></category>
		<category><![CDATA[nodejs]]></category>
		<category><![CDATA[not recognized]]></category>
		<category><![CDATA[npm]]></category>
		<category><![CDATA[npm err!]]></category>
		<category><![CDATA[NPM error]]></category>
		<guid isPermaLink="false">https://www.scmgalaxy.com/tutorials/?p=7571</guid>

					<description><![CDATA[<p>Hey if you are getting some error like (&#8216;cross-env&#8217; is not recognized as an internal or external command, operable program [&#8230;]</p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/cross-env-is-not-recognized-as-an-internal-or-external-command-operable-program-or-batch-file/">&#8216;cross-env&#8217; is not recognized as an internal or external command, operable program or batch file.</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">Hey if  you are getting some error like (&#8216;cross-env&#8217; is not recognized as an internal or external command, operable program or batch file.) in your Node please follow the steps which i have mentioned in following:-</p>



<p class="wp-block-paragraph"><strong>You need to make cross-env working globally instead of having it in the project.</strong></p>



<p class="wp-block-paragraph"><strong>Step 1:-</strong> remove <strong><code>node_modules</code></strong> folder</p>



<p class="wp-block-paragraph"><strong>Step 2:-</strong>  run this Command so that you <strong>cross-env </strong>work globally.</p>



<pre class="wp-block-code"><code><span class="has-inline-color has-vivid-red-color">npm install --global cross-env</span></code></pre>



<p class="wp-block-paragraph"><strong>Step 3:-</strong> Remove &#8220;cross-env&#8221;: &#8220;5.0.1&#8221; from the devDependencies section of the package.json file. You may actually skip this step and keep package.json. If you&#8217;d want.</p>



<p class="wp-block-paragraph"><strong>Step 4:-</strong> Then run this command.</p>



<pre class="wp-block-code"><code><span class="has-inline-color has-vivid-red-color">npm install --no-bin-links</span></code></pre>



<p class="wp-block-paragraph"><strong>Step 5:-</strong> After this finally you can run your main command </p>



<pre class="wp-block-code"><code><span class="has-inline-color has-vivid-red-color">npm run dev</span></code></pre>



<p class="wp-block-paragraph"></p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/cross-env-is-not-recognized-as-an-internal-or-external-command-operable-program-or-batch-file/">&#8216;cross-env&#8217; is not recognized as an internal or external command, operable program or batch file.</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.scmgalaxy.com/tutorials/cross-env-is-not-recognized-as-an-internal-or-external-command-operable-program-or-batch-file/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Know about nodejs?</title>
		<link>https://www.scmgalaxy.com/tutorials/know-about-nodejs/</link>
					<comments>https://www.scmgalaxy.com/tutorials/know-about-nodejs/#respond</comments>
		
		<dc:creator><![CDATA[scmgalaxy K]]></dc:creator>
		<pubDate>Tue, 09 Jan 2018 09:10:35 +0000</pubDate>
				<category><![CDATA[Concept & Definition]]></category>
		<category><![CDATA[About nodejs]]></category>
		<category><![CDATA[nodejs]]></category>
		<category><![CDATA[nodejs Introduction]]></category>
		<category><![CDATA[nodejs Overview]]></category>
		<category><![CDATA[What is nodejs]]></category>
		<guid isPermaLink="false">http://www.scmgalaxy.com/tutorials/?p=4629</guid>

					<description><![CDATA[<p>What is nodejs? Node.js untangles concurrency by replacing the Java platform&#8217;s standard, multithreaded approach with single-threaded, event-driven I/O. Node.js (Node) [&#8230;]</p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/know-about-nodejs/">Know about nodejs?</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><strong>What is nodejs?</strong></p>
<p>Node.js untangles concurrency by replacing the Java platform&#8217;s standard, multithreaded approach with single-threaded, event-driven I/O.</p>
<p>Node.js (Node) is an I/O environment built on top of Google Chrome&#8217;s JavaScript runtime — essentially, a server-side implementation of JavaScript. Node&#8217;s asynchronous, event-driven I/O model makes it easy for developers with JavaScript knowledge to build high-performing, scalable, and highly concurrent web applications rapidly and run them in the cloud.</p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/know-about-nodejs/">Know about nodejs?</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.scmgalaxy.com/tutorials/know-about-nodejs/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
