<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Louis Bertson</title>
    <description>The latest articles on DEV Community by Louis Bertson (@louis_bertson_1124e9cdc59).</description>
    <link>https://dev.to/louis_bertson_1124e9cdc59</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1026890%2F198894e6-d83d-4a8c-bf19-1fec26debe8f.jpeg</url>
      <title>DEV Community: Louis Bertson</title>
      <link>https://dev.to/louis_bertson_1124e9cdc59</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/louis_bertson_1124e9cdc59"/>
    <language>en</language>
    <item>
      <title>Total.js v5: Schemas and Actions.</title>
      <dc:creator>Louis Bertson</dc:creator>
      <pubDate>Tue, 26 Nov 2024 11:24:54 +0000</pubDate>
      <link>https://dev.to/louis_bertson_1124e9cdc59/totaljs-v5-schemas-and-actions-6kf</link>
      <guid>https://dev.to/louis_bertson_1124e9cdc59/totaljs-v5-schemas-and-actions-6kf</guid>
      <description>&lt;h1&gt;
  
  
  Total.js v5: Schemas and Actions.
&lt;/h1&gt;

&lt;p&gt;If you’re diving into Total.js development, you’ve chosen a robust, modern framework that’s packed with powerful features for building fast, scalable applications. At the heart of Total.js are two essential concepts that will guide much of your backend logic: &lt;strong&gt;schemas&lt;/strong&gt; and &lt;strong&gt;actions&lt;/strong&gt;.&lt;br&gt;
Schemas and actions might seem complex at first, but once you understand how they work together, they’ll become some of your favorite tools in the framework. In this guide, I’ll break down these concepts, show you&lt;br&gt;
how to set them up, and walk you through practical examples that will empower you to create an organized, flexible codebase. &lt;/p&gt;

&lt;p&gt;Let's get started!&lt;/p&gt;
&lt;h2&gt;
  
  
  Understanding schemas and actions in Total.js
&lt;/h2&gt;

&lt;p&gt;In Total.js, schemas and actions play distinct roles that complement each other:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Schemas&lt;/strong&gt;: These are blueprints for organizing data and the operations that manage it. With schemas, you define the &lt;strong&gt;structure&lt;/strong&gt; of your data and associate it with specific &lt;strong&gt;actions&lt;/strong&gt; that can perform tasks on it, such as creating, updating, or deleting records.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Actions&lt;/strong&gt;: Actions in Total.js represent business logic for performing specific tasks. Actions can be tied to schemas (schema actions) or created as standalone functions that handle tasks not directly linked to any schema.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Think of schemas as structured “folders” where you organize your data logic, while actions are the “tools” that operate on that data. You’ll be able to call actions as needed, whether they belong to a schema or stand alone, and they’re especially useful for handling backend operations like processing user input or interacting with a database.&lt;/p&gt;
&lt;h2&gt;
  
  
  Getting Started with Schemas in Total.js
&lt;/h2&gt;
&lt;h3&gt;
  
  
  1. Setting Up a Basic Schema
&lt;/h3&gt;

&lt;p&gt;A schema in Total.js is more than just a data structure. It’s a powerful way to group related actions that handle specific tasks for a particular type of data. Here’s a simple example of creating a schema for &lt;code&gt;Users&lt;/code&gt;.&lt;br&gt;
In your total.js application create a folder &lt;code&gt;schemas&lt;/code&gt; and then create a file &lt;code&gt;users.js&lt;/code&gt; inside to paste the following:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nc"&gt;NEWSCHEMA&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Users&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;schema&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// Action: list&lt;/span&gt;
    &lt;span class="nx"&gt;schema&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;action&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;list&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Listing operation&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="na"&gt;query&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;*search:String&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;// Query parameters&lt;/span&gt;
        &lt;span class="na"&gt;action&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;$&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="c1"&gt;// Action logic goes here&lt;/span&gt;
            &lt;span class="nx"&gt;$&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;success&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt; &lt;span class="c1"&gt;// Send a success response&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;});&lt;/span&gt;

    &lt;span class="c1"&gt;// Action: insert&lt;/span&gt;
    &lt;span class="nx"&gt;schema&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;action&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;insert&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
         &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Creation operation&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="na"&gt;input&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;*name:String, *email:Email&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;// Input validation&lt;/span&gt;
        &lt;span class="na"&gt;action&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;$&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;model&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="c1"&gt;// Action logic for inserting user&lt;/span&gt;
            &lt;span class="nx"&gt;$&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;success&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;model&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// Respond with the inserted model data&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;});&lt;/span&gt;

    &lt;span class="c1"&gt;// Action: read&lt;/span&gt;
    &lt;span class="nx"&gt;schema&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;action&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;read&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
         &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Reading operation&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="na"&gt;params&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;*id:UID&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;// Parameter validation&lt;/span&gt;
        &lt;span class="na"&gt;action&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;$&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="c1"&gt;// Action logic to read a user by ID&lt;/span&gt;
            &lt;span class="nx"&gt;$&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;success&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt; &lt;span class="c1"&gt;// Send a success response&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;});&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this example, we created a schema called &lt;code&gt;Users&lt;/code&gt; with three actions:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;list&lt;/strong&gt;: Returns a list of users based on search parameters.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;insert&lt;/strong&gt;: Adds a new user to the database with validation for required fields (&lt;code&gt;name&lt;/code&gt; and &lt;code&gt;email&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;read&lt;/strong&gt;: Retrieves a specific user by their unique ID.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;By organizing these actions within the &lt;code&gt;Users&lt;/code&gt; schema, you create a cohesive set of operations for handling user data.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Linking Schemas to Routes
&lt;/h3&gt;

&lt;p&gt;To make these schema actions accessible via HTTP requests, you can link them to routes in Total.js. This will allow your frontend or API clients to call these actions. Just create a controller file &lt;code&gt;controllers/api.js&lt;/code&gt; to put the following:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;exports&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;install&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;function &lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nc"&gt;ROUTE&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;GET  /api/users/         --&amp;gt; Users/list&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="nc"&gt;ROUTE&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;POST /api/users/insert   --&amp;gt; Users/insert&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="nc"&gt;ROUTE&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;GET  /api/users/{id}     --&amp;gt; Users/read&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this example:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A &lt;code&gt;GET&lt;/code&gt; request to &lt;code&gt;/api/users/&lt;/code&gt; will call the &lt;code&gt;list&lt;/code&gt; action.&lt;/li&gt;
&lt;li&gt;A &lt;code&gt;POST&lt;/code&gt; request to &lt;code&gt;/api/users/insert&lt;/code&gt; will invoke the &lt;code&gt;insert&lt;/code&gt; action.&lt;/li&gt;
&lt;li&gt;A &lt;code&gt;GET&lt;/code&gt; request to &lt;code&gt;/api/users/{id}/&lt;/code&gt; will trigger the &lt;code&gt;read&lt;/code&gt; action with a unique user ID passed in the URL.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This structure keeps your routing and backend logic organized and straightforward.&lt;/p&gt;

&lt;h2&gt;
  
  
  Standalone actions
&lt;/h2&gt;

&lt;p&gt;While schema actions are great for data-centric tasks, sometimes you’ll need an action that performs a standalone operation, not linked to a specific schema. Standalone actions are defined independently and can be used for any custom backend functionality.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Creating a Standalone Action
&lt;/h3&gt;

&lt;p&gt;Total.js recommand to create your actions file in &lt;code&gt;actions&lt;/code&gt; folder. But you can put them somewhere else like (&lt;code&gt;schemas,definitions,modules,etc&lt;/code&gt;)&lt;br&gt;
Let’s say we want to create a standalone action called &lt;code&gt;find&lt;/code&gt;. This action accepts query parameters for pagination and sorting without being tied to a schema.&lt;/p&gt;

&lt;p&gt;Let us create this file in &lt;code&gt;actions/default.js&lt;/code&gt; and copy/paste the following:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nc"&gt;NEWACTION&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;find&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;query&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;page:Number,sort:String&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;params&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;projectid:String&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;action&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;$&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="c1"&gt;// Logic to find specific data based on query and params&lt;/span&gt;
        &lt;span class="nx"&gt;$&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;success&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt; &lt;span class="c1"&gt;// Send a success response&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This &lt;code&gt;find&lt;/code&gt; action can be called to handle any general-purpose data search, making it a flexible solution for various backend needs.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Connecting standalone actions to routes
&lt;/h3&gt;

&lt;p&gt;Just like schema actions, standalone actions need to be linked to routes to be accessed from your API or frontend.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nc"&gt;ROUTE&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;GET /api/find/           --&amp;gt; find&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With this route, a &lt;code&gt;GET&lt;/code&gt; request to &lt;code&gt;/api/find/&lt;/code&gt; will call the standalone &lt;code&gt;find&lt;/code&gt; action.&lt;/p&gt;

&lt;h2&gt;
  
  
  Using ACTION()
&lt;/h2&gt;

&lt;p&gt;Total.js provides the &lt;code&gt;ACTION()&lt;/code&gt; method, a way to call both schema-related and standalone actions in your code.&lt;/p&gt;

&lt;h3&gt;
  
  
  Example
&lt;/h3&gt;

&lt;p&gt;Let’s call the &lt;code&gt;Users/insert&lt;/code&gt; action we created earlier using &lt;code&gt;ACTION()&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nc"&gt;ACTION&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Users/insert&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;John&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;email&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;johndoe@gmail.com&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;}).&lt;/span&gt;&lt;span class="nf"&gt;callback&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;err&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;response&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;err&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Action error:&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;err&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;User insert response:&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;response&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here, we specify the &lt;code&gt;Users/insert&lt;/code&gt; action and pass a search query to find users with “John” in their data. You can use this approach to call any schema or standalone action, making &lt;code&gt;ACTION()&lt;/code&gt; a highly flexible tool.&lt;/p&gt;

&lt;h2&gt;
  
  
  Advanced: Calling Schema Actions Within Other Schema Actions
&lt;/h2&gt;

&lt;p&gt;Total.js allows you to call actions within the same schema using the &lt;code&gt;$.action&lt;/code&gt; method. This feature is powerful for creating complex workflows that involve multiple steps.&lt;/p&gt;

&lt;h3&gt;
  
  
  Example: Nested Schema Actions
&lt;/h3&gt;

&lt;p&gt;Let’s say we want an action in the &lt;code&gt;Users&lt;/code&gt; schema to first list users, then perform additional processing based on that list.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nc"&gt;NEWSCHEMA&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Users&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;schema&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;schema&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;action&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;list&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Listing users&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="na"&gt;query&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;search:String&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="na"&gt;action&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;$&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="nx"&gt;$&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;success&lt;/span&gt;&lt;span class="p"&gt;([{&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;John Doe&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Jane Doe&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;}]);&lt;/span&gt; &lt;span class="c1"&gt;// Sample data&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;});&lt;/span&gt;

    &lt;span class="nx"&gt;schema&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;action&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;proccess&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="na"&gt;action&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;$&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="c1"&gt;// Call the list action within the same schema&lt;/span&gt;
            &lt;span class="nx"&gt;$&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;action&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;list&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;callback&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;err&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;users&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
                &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;err&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;$&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;invalid&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;err&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

                &lt;span class="c1"&gt;// Process users after retrieving the list&lt;/span&gt;
                &lt;span class="nx"&gt;users&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;forEach&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;user&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
                    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Processing user:&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
                &lt;span class="p"&gt;});&lt;/span&gt;
                &lt;span class="nx"&gt;$&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;success&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Users processed successfully!&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
            &lt;span class="p"&gt;});&lt;/span&gt;

            &lt;span class="c1"&gt;// or &lt;/span&gt;
            &lt;span class="c1"&gt;// var response = await $.action('list').query({ search: 'totaljs' }).user($.user).promise($);&lt;/span&gt;


        &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;});&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this example, &lt;code&gt;proccess&lt;/code&gt; calls &lt;code&gt;list&lt;/code&gt; within the &lt;code&gt;Users&lt;/code&gt; schema. This structure is great for chaining operations within schemas and gives you full control over workflow management.&lt;/p&gt;

&lt;h3&gt;
  
  
  Advanced usage
&lt;/h3&gt;

&lt;p&gt;Total.js v5 allows so many other usages of &lt;code&gt;NEWSCHEMA&lt;/code&gt; and &lt;code&gt;NEWACTION&lt;/code&gt; for very specific cases. We are not going to cover them here because we are preparing another blog post for them. But if you are curious about learning them you can check &lt;a href="https://blog.totaljs.com/posts/2081276001ky71b/" rel="noopener noreferrer"&gt;this blog post&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Key Takeaways and Tips
&lt;/h2&gt;

&lt;p&gt;Working with schemas and actions in Total.js can elevate your application’s structure and efficiency. Here are some key points to keep in mind:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Schemas&lt;/strong&gt; are collections of related actions tied to specific data entities. Use them to organize and validate your data-centric actions.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Standalone actions&lt;/strong&gt; allow you to build independent functions for tasks that don’t fit within a schema.&lt;/li&gt;
&lt;li&gt;Use &lt;code&gt;ACTION()&lt;/code&gt; for flexible action calls, whether they’re schema-based or standalone.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Route linking&lt;/strong&gt; connects your actions to HTTP endpoints, making your backend logic accessible via API routes.&lt;/li&gt;
&lt;li&gt;For more complex workflows, &lt;strong&gt;nested actions&lt;/strong&gt; within schemas give you a streamlined way to manage multi-step processes.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;With these foundations in place, you’re ready to start building robust, modular backend logic in Total.js! Experiment with different schema and action configurations, and don’t hesitate to explore Total.js’s extensive documentation as you continue to master this flexible framework. &lt;/p&gt;

&lt;p&gt;Happy coding!&lt;/p&gt;

</description>
    </item>
    <item>
      <title>QueryBuilder in Action Part 1</title>
      <dc:creator>Louis Bertson</dc:creator>
      <pubDate>Mon, 25 Nov 2024 13:30:26 +0000</pubDate>
      <link>https://dev.to/louis_bertson_1124e9cdc59/querybuilder-in-action-part-1-4pp6</link>
      <guid>https://dev.to/louis_bertson_1124e9cdc59/querybuilder-in-action-part-1-4pp6</guid>
      <description>&lt;p&gt;When building applications with Node.js in general or Total.js specifically, querying and managing data efficiently is essential. In this blog, we’ll cover how to perform basic data operations using the Total.js &lt;code&gt;QueryBuilder&lt;/code&gt;. This first part will introduce fundamental concepts, demonstrate core actions like inserting and retrieving data, and showcase practical examples to get you started.&lt;/p&gt;

&lt;h3&gt;
  
  
  Getting Started: Exploring &lt;code&gt;QueryBuilder&lt;/code&gt; in Total.js
&lt;/h3&gt;

&lt;p&gt;Total.js’s &lt;code&gt;QueryBuilder&lt;/code&gt; offers a powerful abstraction layer for interacting with various databases through operations such as filtering, inserting, updating, and retrieving data. Whether you're working on a lightweight application or managing complex queries, &lt;code&gt;QueryBuilder&lt;/code&gt; provides a simple yet flexible ORM solution for Node.js applications.&lt;/p&gt;

&lt;h4&gt;
  
  
  Database Support and Implementations
&lt;/h4&gt;

&lt;p&gt;&lt;code&gt;QueryBuilder&lt;/code&gt; acts as a middle layer, abstracting the specifics of database engines. To utilize it effectively, you’ll need to integrate an existing implementation or build your own that meets your requirements. Total.js supports multiple database engines, ensuring flexibility for different use cases.&lt;/p&gt;

&lt;p&gt;Here are the currently available implementations:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;NoSQL Embedded Database (TextDB):&lt;/strong&gt; This is a lightweight, file-based database included in the Total.js core, perfect for small applications or prototyping.
&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://github.com/totaljs/querybuilderpg" rel="noopener noreferrer"&gt;&lt;strong&gt;PostgreSQL:&lt;/strong&gt;&lt;/a&gt; Utilize &lt;code&gt;QueryBuilder&lt;/code&gt; with one of the most robust and feature-rich relational databases.
&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://github.com/totaljs/querybuildermysql2" rel="noopener noreferrer"&gt;&lt;strong&gt;MySQL:&lt;/strong&gt;&lt;/a&gt; Integrate with this widely used database for scalable and high-performance solutions.
&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://github.com/totaljs/querybuildersqlite3" rel="noopener noreferrer"&gt;&lt;strong&gt;SQLite:&lt;/strong&gt;&lt;/a&gt; Leverage &lt;code&gt;QueryBuilder&lt;/code&gt; with this lightweight, serverless database for quick deployments or embedded applications.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Setting Up &lt;code&gt;QueryBuilder&lt;/code&gt;
&lt;/h4&gt;

&lt;p&gt;In this guide, we’ll start with an embedded &lt;strong&gt;NoSQL&lt;/strong&gt; (&lt;strong&gt;TextDB&lt;/strong&gt;) database to demonstrate how to define schemas and perform basic actions like querying, inserting, and updating data. By the end, you’ll have the skills to adapt these operations for other supported database engines.&lt;/p&gt;

&lt;h3&gt;
  
  
  Setting up the Database
&lt;/h3&gt;

&lt;p&gt;To learn effectively, we'll create a test NoSQL database file with sample user data.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Database Setup&lt;/strong&gt;: Create a &lt;code&gt;databases/users.nosql&lt;/code&gt; file to store sample user records:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nl"&gt;"id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Bob"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"age"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;30&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nl"&gt;"id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Charlie"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"age"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;28&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nl"&gt;"id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Diana"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"age"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;22&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nl"&gt;"id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Edward"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"age"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;35&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nl"&gt;"id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"John"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"age"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;45&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nl"&gt;"id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;7&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Fiona"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"age"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;27&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nl"&gt;"id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;8&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"George"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"age"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;29&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nl"&gt;"id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;9&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Hannah"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"age"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;24&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nl"&gt;"id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Isaac"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"age"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;31&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nl"&gt;"id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;11&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Julia"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"age"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;26&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Good to know&lt;/strong&gt;: You don't need to manually create the &lt;code&gt;.nosql&lt;/code&gt; file in the &lt;code&gt;databases&lt;/code&gt; folder. The framework is able to create it during the &lt;code&gt;insert&lt;/code&gt; operation if it does not exists. But the &lt;code&gt;.nosql&lt;/code&gt; file content is plaintext and it is important to understand its structure. Maybe it will be usefull to fix certain cases.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Schema Definition&lt;/strong&gt;: Create a schema with actions in schemas/users.js. We’ll define actions for listing, retrieving, and inserting users.&lt;/p&gt;

&lt;h3&gt;
  
  
  Basic QueryBuilder Actions with Practical Examples
&lt;/h3&gt;

&lt;p&gt;In &lt;code&gt;schemas/users.js&lt;/code&gt;, we'll define actions for listing and inserting users. This schema uses &lt;code&gt;QueryBuilder&lt;/code&gt; methods to filter data, retrieve specific records, and add new users to the database.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Listing Users with Filters&lt;/strong&gt;&lt;br&gt;
We start by defining a list action to retrieve users based on criteria like name or age.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nc"&gt;NEWSCHEMA&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Users&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;schema&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;

    &lt;span class="nx"&gt;schema&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;action&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;list&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;List users&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="na"&gt;query&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;page:Number, sort:String, name:String&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="na"&gt;params&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;id:String&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="na"&gt;action&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;$&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="c1"&gt;// Example: filter by name&lt;/span&gt;
            &lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;users&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;DATA&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;find&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;nosql/users&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;where&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;name&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;$&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;query&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;promise&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
            &lt;span class="nx"&gt;$&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;callback&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;users&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; 
        &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;});&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Usage Examples&lt;/strong&gt;:&lt;/p&gt;

&lt;p&gt;Here are some variations of using &lt;code&gt;list&lt;/code&gt; to filter users.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Filter by Name&lt;/strong&gt;:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;users&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nc"&gt;ACTION&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Users/list&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;where&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;name&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;John&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;promise&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;users&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Retrieve First User Only&lt;/strong&gt;:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;user&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;DATA&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;find&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;nosql/users&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;first&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;promise&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;2. Retrieving a User by ID&lt;/strong&gt;&lt;br&gt;
Another useful feature is retrieving a user by their ID. Using &lt;code&gt;QueryBuilder&lt;/code&gt;'s &lt;code&gt;.id()&lt;/code&gt; method makes this straightforward:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;builder&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;DATA&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;find&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;nosql/users&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;builder&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;id&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;$&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;params&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="c1"&gt;// or builder.where('id', $.params.id);&lt;/span&gt;
&lt;span class="nx"&gt;$&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;callback&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;builder&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;promise&lt;/span&gt;&lt;span class="p"&gt;());&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Example Usage&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;user&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nc"&gt;ACTION&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Users/list&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;params&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt; &lt;span class="p"&gt;}).&lt;/span&gt;&lt;span class="nf"&gt;promise&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;  &lt;span class="c1"&gt;// Retrieves user with id 5&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;3. Inserting a New User&lt;/strong&gt;&lt;br&gt;
Next, let’s define an &lt;code&gt;insert&lt;/code&gt; action to add new users to the database.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;schema&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;action&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;insert&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Inserting new users&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;input&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;*name:String, age:Number&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;output&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;success:Boolean&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;action&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;$&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;model&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nx"&gt;DATA&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;insert&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;nosql/users&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;model&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;callback&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;err&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;err&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
                &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;err&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
            &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
                &lt;span class="nx"&gt;$&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;success&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
            &lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="p"&gt;});&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This action adds a user to &lt;code&gt;databases/users.nosql&lt;/code&gt;. Here’s how you can call the &lt;code&gt;insert&lt;/code&gt; action.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Usage Example&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// in `definitions/test.js`&lt;/span&gt;
&lt;span class="nc"&gt;ON&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;ready&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nc"&gt;ACTION&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Users/insert&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Alice&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;age&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;25&lt;/span&gt; &lt;span class="p"&gt;}).&lt;/span&gt;&lt;span class="nf"&gt;promise&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;result&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Practical Usage Cases: QueryBuilder in Action
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;1. Retrieve Users by Filtered Name&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;getUsersByName&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;users&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nc"&gt;ACTION&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Users/list&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;query&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Hannah&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;}).&lt;/span&gt;&lt;span class="nf"&gt;promise&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;users&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="nf"&gt;getUsersByName&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;2. Retrieve User by ID&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;getUserByID&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;user&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nc"&gt;ACTION&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Users/list&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;params&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt; &lt;span class="p"&gt;}).&lt;/span&gt;&lt;span class="nf"&gt;promise&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="nf"&gt;getUserByID&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;3. Insert a New User and Retrieve the Updated List&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;insertAndRetrieve&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nc"&gt;ACTION&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Users/insert&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;James&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;age&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;32&lt;/span&gt; &lt;span class="p"&gt;}).&lt;/span&gt;&lt;span class="nf"&gt;promise&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
    &lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;users&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nc"&gt;ACTION&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Users/list&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;promise&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;users&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="nf"&gt;insertAndRetrieve&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;In this first part of QueryBuilder in Action, we covered the essentials: creating a basic NoSQL database, defining schema actions, and using &lt;code&gt;QueryBuilder&lt;/code&gt; methods to &lt;code&gt;list&lt;/code&gt;, &lt;code&gt;filter&lt;/code&gt;, &lt;code&gt;retrieve&lt;/code&gt;, and &lt;code&gt;insert&lt;/code&gt; users. We explored practical code examples for each operation to help you understand how these concepts work in a real-world scenario.&lt;br&gt;
In the next part, we’ll dive into more advanced &lt;code&gt;QueryBuilder&lt;/code&gt; methods, and complex filtering to give you a complete toolkit for managing data efficiently in &lt;code&gt;Total.js&lt;/code&gt;.&lt;br&gt;
Stay tuned for QueryBuilder in Action Part 2, where we'll go deeper into advanced querying techniques to supercharge your &lt;code&gt;Total.js&lt;/code&gt; applications!&lt;/p&gt;

</description>
      <category>totaljs</category>
      <category>node</category>
      <category>javascript</category>
      <category>prisma</category>
    </item>
    <item>
      <title>Performance Testing: Total.js vs. NestJS</title>
      <dc:creator>Louis Bertson</dc:creator>
      <pubDate>Wed, 23 Oct 2024 11:14:09 +0000</pubDate>
      <link>https://dev.to/louis_bertson_1124e9cdc59/performance-testing-totaljs-vs-nestjs-1lfo</link>
      <guid>https://dev.to/louis_bertson_1124e9cdc59/performance-testing-totaljs-vs-nestjs-1lfo</guid>
      <description>&lt;p&gt;When it comes to building &lt;strong&gt;high-performance applications&lt;/strong&gt; in Node.js, choosing the right framework is crucial for optimizing &lt;strong&gt;concurrency&lt;/strong&gt;, &lt;strong&gt;response times&lt;/strong&gt;, and &lt;strong&gt;resource utilization&lt;/strong&gt;. In this article, we’ll provide a &lt;strong&gt;comprehensive performance comparison&lt;/strong&gt; between &lt;strong&gt;Total.js&lt;/strong&gt; (versions 4 and 5) and &lt;strong&gt;NestJS&lt;/strong&gt;, two frameworks designed with different philosophies and use cases.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Why Compare Total.js and NestJS?&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Total.js&lt;/strong&gt;: Known for its &lt;strong&gt;minimalist design&lt;/strong&gt;, Total.js emphasizes &lt;strong&gt;speed&lt;/strong&gt; and &lt;strong&gt;simplicity&lt;/strong&gt;, making it ideal for performance-focused applications.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;NestJS&lt;/strong&gt;: Built for an exceptional &lt;strong&gt;developer experience&lt;/strong&gt;, NestJS follows a &lt;strong&gt;modular architecture&lt;/strong&gt;, inspired by Angular, making it a go-to for larger, more complex applications.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;While both frameworks cater to distinct project needs, this comparison aims to identify which one is better suited for &lt;strong&gt;scalable, high-performance&lt;/strong&gt; applications.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Test Methodology: Fair and Accurate Comparisons&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;To ensure a fair and &lt;strong&gt;unbiased performance test&lt;/strong&gt;, the methodology simulates real-world stress conditions, measuring several key metrics:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Response Time&lt;/strong&gt;: The time taken to process &lt;strong&gt;10,000 requests&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Concurrency Handling&lt;/strong&gt;: How well the frameworks scale with increasing connections.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Project Size&lt;/strong&gt;: The size of the source code and dependencies required to set up a basic application.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Hardware and Testing Environment&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Machine&lt;/strong&gt;: iMac Intel Monterey, 12GB RAM&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Node.js Version&lt;/strong&gt;: v21&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Testing Tool&lt;/strong&gt;: &lt;a href="https://github.com/codesenberg/bombardier" rel="noopener noreferrer"&gt;Bombardier&lt;/a&gt; (for simulating high-concurrency requests)&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Step-by-Step Code Setup&lt;/strong&gt;
&lt;/h2&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;1. Setting Up Total.js v4&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Step 1&lt;/strong&gt;: Create the project folder:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;mkdir &lt;/span&gt;total4
&lt;span class="nb"&gt;cd &lt;/span&gt;total4
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 2&lt;/strong&gt;: Initialize the project and install dependencies:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm init &lt;span class="nt"&gt;-y&lt;/span&gt;
npm &lt;span class="nb"&gt;install &lt;/span&gt;total4
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 3&lt;/strong&gt;: Create the &lt;code&gt;index.js&lt;/code&gt; file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;total4&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="nc"&gt;ROUTE&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;GET /&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;html&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Hello world!&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;

&lt;span class="nc"&gt;HTTP&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;release&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;port&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;8000&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 4&lt;/strong&gt;: Start the Total.js v4 server:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;node index.js
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;strong&gt;2. Setting Up Total.js v5&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Step 1&lt;/strong&gt;: Create the project folder:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;mkdir &lt;/span&gt;total5
&lt;span class="nb"&gt;cd &lt;/span&gt;total5
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 2&lt;/strong&gt;: Initialize the project and install dependencies:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm init &lt;span class="nt"&gt;-y&lt;/span&gt;
npm &lt;span class="nb"&gt;install &lt;/span&gt;total5
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 3&lt;/strong&gt;: Create the &lt;code&gt;index.js&lt;/code&gt; file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;total5&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="nc"&gt;ROUTE&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;GET /&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;$&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;$&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;html&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Hello world!&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;span class="nx"&gt;DEBUG&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nx"&gt;F&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;http&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;port&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;8001&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 4&lt;/strong&gt;: Start the Total.js v5 server:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;node index.js
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;strong&gt;3. Setting Up NestJS&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Step 1&lt;/strong&gt;: Create the project folder:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;mkdir &lt;/span&gt;nestjs-app
&lt;span class="nb"&gt;cd &lt;/span&gt;nestjs-app
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 2&lt;/strong&gt;: Initialize a new NestJS project using the &lt;strong&gt;NestJS CLI&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-g&lt;/span&gt; @nestjs/cli
nest new &lt;span class="nb"&gt;.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When prompted, select &lt;strong&gt;npm&lt;/strong&gt; as your package manager.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 3&lt;/strong&gt;: Modify the &lt;code&gt;main.ts&lt;/code&gt; file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;NestFactory&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;@nestjs/core&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;AppModule&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;./app.module&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;bootstrap&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;app&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;NestFactory&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;create&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;AppModule&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;listen&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;3000&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="nf"&gt;bootstrap&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 4&lt;/strong&gt;: Start the NestJS server:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm run start
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  &lt;strong&gt;Running the Performance Test&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Once all servers are up and running on their respective ports:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Total.js v4&lt;/strong&gt; on &lt;code&gt;8000&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Total.js v5&lt;/strong&gt; on &lt;code&gt;8001&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;NestJS&lt;/strong&gt; on &lt;code&gt;3000&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Step 1&lt;/strong&gt;: Create a test folder:
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;mkdir &lt;/span&gt;performance-test
&lt;span class="nb"&gt;cd &lt;/span&gt;performance-test
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;strong&gt;Step 2&lt;/strong&gt;: Initialize the project and install dependencies:
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm init &lt;span class="nt"&gt;-y&lt;/span&gt;
npm &lt;span class="nb"&gt;install &lt;/span&gt;total5
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;strong&gt;Step 3&lt;/strong&gt;: Create the &lt;code&gt;run.js&lt;/code&gt; file:
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;total5&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;run&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;url&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;count&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;callback&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;time&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="nx"&gt;count&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;async&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;index&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;next&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;opt&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{};&lt;/span&gt;
        &lt;span class="nx"&gt;opt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;method&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;GET&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="nx"&gt;opt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;url&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;url&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="nx"&gt;opt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;dnscache&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="nx"&gt;opt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;keepalive&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="nx"&gt;opt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;callback&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;err&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;response&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="nx"&gt;err&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;ERROR &lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;name&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;:&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;err&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
            &lt;span class="nf"&gt;next&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
        &lt;span class="p"&gt;};&lt;/span&gt;
        &lt;span class="nc"&gt;REQUEST&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;opt&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;},&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;timeEnd&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="nx"&gt;callback&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nf"&gt;callback&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
    &lt;span class="p"&gt;});&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;COUNT&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;10000&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;arr&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Nest.js&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;url&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;http://127.0.0.1:3000/&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Total.js: 4&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;url&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;http://127.0.0.1:8000/&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Total.js: 5&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;url&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;http://127.0.0.1:8001/&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;];&lt;/span&gt;

&lt;span class="c1"&gt;// Add multiple rounds&lt;/span&gt;
&lt;span class="nx"&gt;arr&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;push&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;apply&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;arr&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;arr&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;arr&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;push&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;apply&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;arr&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;arr&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="nx"&gt;arr&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;wait&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;item&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;next&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nf"&gt;run&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;item&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;item&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;url&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;COUNT&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;next&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;strong&gt;Step 4&lt;/strong&gt;: Run the performance test:
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;node run.js
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  &lt;strong&gt;Performance Results&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;After running &lt;strong&gt;10,000 concurrent requests&lt;/strong&gt;, here are the results:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5wq8k311gsn0ass6zbys.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5wq8k311gsn0ass6zbys.jpg" alt="Xnapper-2024-10-22-04.00.34.jpg" width="800" height="282"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;strong&gt;Framework&lt;/strong&gt;&lt;/th&gt;
&lt;th&gt;&lt;strong&gt;Average Response Time (10,000 requests)&lt;/strong&gt;&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Total.js v4&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;3.36 seconds&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Total.js v5&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;3.30 seconds&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;NestJS&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;4.88 seconds&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Project Size Comparison&lt;/strong&gt;
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;strong&gt;Framework&lt;/strong&gt;&lt;/th&gt;
&lt;th&gt;&lt;strong&gt;Project Size&lt;/strong&gt;&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Total.js v4&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;1.7 MB&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Total.js v5&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;909 kB&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;NestJS&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;118 MB&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Startup Time Comparison&lt;/strong&gt;
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;strong&gt;Framework&lt;/strong&gt;&lt;/th&gt;
&lt;th&gt;&lt;strong&gt;Startup Time&lt;/strong&gt;&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Total.js v4&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;Instant&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Total.js v5&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;Instant&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;NestJS&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;Compiled (slower)&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Key Takeaways&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;1.&lt;strong&gt;Total.js is Faster&lt;/strong&gt;: Both &lt;strong&gt;Total.js v4&lt;/strong&gt; and &lt;strong&gt;v5&lt;/strong&gt; outperformed NestJS by an average of &lt;strong&gt;1.5 seconds&lt;/strong&gt; in response time, which is crucial for speed-critical applications.&lt;/p&gt;

&lt;p&gt;2.&lt;strong&gt;Compact Project Sizes&lt;/strong&gt;: Total.js projects are incredibly lightweight, with &lt;strong&gt;Total.js v5&lt;/strong&gt; requiring less than &lt;strong&gt;1 MB&lt;/strong&gt;, while NestJS can take up to &lt;strong&gt;118 MB&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;3.&lt;strong&gt;Instant Startup&lt;/strong&gt;: Thanks to &lt;strong&gt;CommonJS&lt;/strong&gt;, Total.js apps launch almost instantly, while NestJS requires a TypeScript compilation process, resulting in slower startups.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Why Choose Total.js?&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;All-in-One Framework&lt;/strong&gt;: Total.js provides a comprehensive set of built-in tools (HTTP, REST API, real-time, static file servers, etc.) without the need for extra libraries.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Speed-Oriented&lt;/strong&gt;: The framework’s minimalist approach leads to faster request handling, making it suitable for high-concurrency applications.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Smaller Footprint&lt;/strong&gt;: The compact size and modularity of Total.js make it ideal for projects focused on performance and resource management.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Integrated Tools&lt;/strong&gt;: With tools like &lt;a href="https://www.totaljs.com/flow" rel="noopener noreferrer"&gt;&lt;strong&gt;Flow&lt;/strong&gt;&lt;/a&gt;, &lt;a href="https://www.totaljs.com/cms" rel="noopener noreferrer"&gt;&lt;strong&gt;CMS&lt;/strong&gt;&lt;/a&gt;, and &lt;a href="https://www.totaljs.com/code" rel="noopener noreferrer"&gt;&lt;strong&gt;Code Editor&lt;/strong&gt;&lt;/a&gt;, Total.js offers a complete ecosystem for &lt;strong&gt;rapid development&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Conclusion&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;For developers prioritizing &lt;strong&gt;speed&lt;/strong&gt;, &lt;strong&gt;efficiency&lt;/strong&gt;, and rapid application development, &lt;strong&gt;Total.js&lt;/strong&gt; proves to be the superior framework in Node.js. It outperforms &lt;strong&gt;NestJS&lt;/strong&gt; in terms of &lt;strong&gt;response time&lt;/strong&gt;, &lt;strong&gt;resource utilization&lt;/strong&gt;, and &lt;strong&gt;project size&lt;/strong&gt;, making it the go-to framework for &lt;strong&gt;high-performance, scalable applications&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Download the complete test setup and scripts &lt;a href="https://cdn.totaljs.com/download/nest-total4-total5.zip" rel="noopener noreferrer"&gt;here&lt;/a&gt; to run your own performance tests.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Total.js&lt;/strong&gt;: &lt;a href="https://www.totaljs.com" rel="noopener noreferrer"&gt;Total.js Framework&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;NestJS&lt;/strong&gt;: &lt;a href="https://nestjs.com" rel="noopener noreferrer"&gt;NestJS Documentation&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Bombardier&lt;/strong&gt;: &lt;a href="https://github.com/codesenberg/bombardier" rel="noopener noreferrer"&gt;Bombardier on GitHub&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

</description>
    </item>
    <item>
      <title>Total js UI #3 Data binding part 1</title>
      <dc:creator>Louis Bertson</dc:creator>
      <pubDate>Mon, 02 Sep 2024 18:21:00 +0000</pubDate>
      <link>https://dev.to/louis_bertson_1124e9cdc59/total-js-ui-3-data-binding-part-1-5958</link>
      <guid>https://dev.to/louis_bertson_1124e9cdc59/total-js-ui-3-data-binding-part-1-5958</guid>
      <description>&lt;h1&gt;
  
  
  Total js UI #3 Data binding part 1
&lt;/h1&gt;

&lt;p&gt;In this tutorial, we delve into the fundamentals of data binding in &lt;a href="https://docs.totaljs.com/components/40d04001gw51c/" rel="noopener noreferrer"&gt;Total.js UI—a key concept that connects your user interface with data models&lt;/a&gt;, making your app dynamic and responsive.&lt;/p&gt;

&lt;h3&gt;
  
  
  In this video, you'll learn:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;What data binding is and why it matters&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;The UI builder HTML element &lt;code&gt;&amp;lt;ui-bind&amp;gt;&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Key element attributes and how to use them&lt;/li&gt;
&lt;li&gt;A deep dive into &lt;code&gt;ui-binding&lt;/code&gt; commands&lt;/li&gt;
&lt;li&gt;Practical examples of &lt;code&gt;ui-bind&lt;/code&gt; commands in action&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Whether you’re new to Total.js or looking to enhance your skills, this video provides the essential knowledge to start building dynamic UIs with ease.&lt;/p&gt;

&lt;p&gt;🔔 &lt;strong&gt;Don’t forget to like, subscribe, and hit the notification bell&lt;/strong&gt; to stay updated with the latest tutorials!&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/Nd6HDpeycD0"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Total.js Enterprise&lt;/strong&gt;: &lt;a href="https://www.totaljs.com/enterprise" rel="noopener noreferrer"&gt;Total.js Enterprise&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;GitHub&lt;/strong&gt;: &lt;a href="https://github.com/totaljs" rel="noopener noreferrer"&gt;Total.js on GitHub&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Stack Overflow&lt;/strong&gt;: &lt;a href="https://stackoverflow.com/questions/tagged/total.js" rel="noopener noreferrer"&gt;Total.js questions on Stack Overflow&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Telegram&lt;/strong&gt;: &lt;a href="https://t.me/totaljs" rel="noopener noreferrer"&gt;Total.js Telegram group&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;WhatsApp&lt;/strong&gt;: &lt;a href="https://chat.whatsapp.com/IgyfyySDuOlH3WF1Iqa33o" rel="noopener noreferrer"&gt;Total.js WhatsApp group&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Twitter&lt;/strong&gt;: &lt;a href="https://twitter.com/totalframework" rel="noopener noreferrer"&gt;Total.js on Twitter&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Facebook&lt;/strong&gt;: &lt;a href="https://www.facebook.com/totaljs.web.framework/" rel="noopener noreferrer"&gt;Total.js on Facebook&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;LinkedIn&lt;/strong&gt;: &lt;a href="https://www.linkedin.com/groups/8109884" rel="noopener noreferrer"&gt;Total.js LinkedIn group&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Reddit&lt;/strong&gt;: &lt;a href="https://www.reddit.com/r/totaljs/" rel="noopener noreferrer"&gt;Total.js subreddit&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Discord&lt;/strong&gt;: &lt;a href="https://discord.gg/Vwd6rAp4" rel="noopener noreferrer"&gt;Total.js Discord server&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Slack&lt;/strong&gt;: &lt;a href="https://totaljs.slack.com/" rel="noopener noreferrer"&gt;Total.js Slack channel&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>totaljs</category>
      <category>totaljsui</category>
      <category>uidesign</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Total.js UI :Two Beginner Projects to understand Paths and Data Binding</title>
      <dc:creator>Louis Bertson</dc:creator>
      <pubDate>Tue, 13 Aug 2024 14:35:12 +0000</pubDate>
      <link>https://dev.to/louis_bertson_1124e9cdc59/totaljs-ui-two-beginner-projects-to-understand-paths-and-data-binding-542g</link>
      <guid>https://dev.to/louis_bertson_1124e9cdc59/totaljs-ui-two-beginner-projects-to-understand-paths-and-data-binding-542g</guid>
      <description>&lt;h3&gt;
  
  
  Introduction
&lt;/h3&gt;

&lt;p&gt;Total.js UI is a lightweight yet powerful framework designed to create dynamic user interfaces with ease and flexibility. It stands out for its intuitive approach, allowing data to be linked to interface elements without heavy configurations or extensive lines of code. This tutorial aims to guide you through two small projects to help you understand and master the concepts of &lt;strong&gt;paths&lt;/strong&gt; and &lt;strong&gt;ui-bind&lt;/strong&gt; in &lt;a href="https://docs.totaljs.com/components/" rel="noopener noreferrer"&gt;Total.js UI&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Paths&lt;/code&gt; and &lt;code&gt;&amp;lt;ui-bind&amp;gt;&lt;/code&gt; are fundamental elements for linking data to user interface elements. &lt;code&gt;Paths&lt;/code&gt; are fundamental components that act as representational addresses to data or functions/actions. They allow you to access, manipulate, and observe data effectively within your application, while &lt;code&gt;&amp;lt;ui-bind&amp;gt;&lt;/code&gt; dynamically binds this data to the interface, ensuring real-time updates. Mastering these concepts will enable you to create responsive and interactive web applications effortlessly.&lt;br&gt;
Now, let's move on to the projects we'll cover in this tutorial. Here's a brief overview of the table of contents:&lt;/p&gt;

&lt;p&gt;1 &lt;strong&gt;Prerequisites&lt;/strong&gt;&lt;br&gt;
2 &lt;strong&gt;Project 1: User Information Update Form&lt;/strong&gt;&lt;br&gt;
3 &lt;strong&gt;Project 2: To-Do List&lt;/strong&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  1. Prerequisites
&lt;/h2&gt;

&lt;p&gt;Before diving into this tutorial on Total.js UI, ensure you have the following prerequisites in place to effectively follow along and complete the projects:&lt;/p&gt;

&lt;p&gt;1 &lt;strong&gt;Basic Knowledge of HTML and JavaScript:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;HTML:&lt;/strong&gt; You should be comfortable with HTML tags, attributes, and          basic page structure. Understanding how to create forms, lists, and other                 common elements is crucial.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;JavaScript:&lt;/strong&gt; Familiarity with JavaScript fundamentals, including variables, functions, and event handling, is necessary. You should be able to write and debug simple scripts that interact with the DOM.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;jQuery:&lt;/strong&gt; Total.js UI integrates jQuery to handle DOM manipulation, event handling, and Ajax, avoiding the need to reinvent the wheel with a new alternative. This ensures a stable, feature-rich experience for building dynamic interfaces. We are not using too much jquery but it is better you have some background of it!&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;2 &lt;strong&gt;Access to a Modern Web Browser:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Web Browser:&lt;/strong&gt; Use a modern web browser such as Google Chrome, Mozilla Firefox, or Microsoft Edge. These browsers support the latest web technologies and provide developer tools for debugging and testing your projects.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;3 &lt;strong&gt;Code Editor:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Code Editor:&lt;/strong&gt; A good code editor is essential for writing and editing your code. Recommended options include:

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://code.visualstudio.com/" rel="noopener noreferrer"&gt;&lt;strong&gt;Visual Studio Code&lt;/strong&gt;&lt;/a&gt;: A powerful, free code editor with robust features and extensions.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.sublimetext.com/" rel="noopener noreferrer"&gt;&lt;strong&gt;Sublime Text&lt;/strong&gt;&lt;/a&gt;: A versatile and lightweight text editor with a clean interface.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://atom.io/" rel="noopener noreferrer"&gt;&lt;strong&gt;Atom&lt;/strong&gt;&lt;/a&gt;: An open-source editor with a user-friendly interface and customizable features.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;4 &lt;strong&gt;Basic Knowledge of CSS:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;CSS:&lt;/strong&gt; Understanding CSS will help you style your web pages and control the layout of your elements. You should know how to use selectors, properties, and values to apply styles to HTML elements.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;5 &lt;strong&gt;Internet Connection:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Connectivity:&lt;/strong&gt; An active internet connection is required to access the CDN links for Total.js UI and any other external libraries used in the projects. Ensure your connection is stable for smooth downloading and integration of resources.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;6 &lt;strong&gt;Basic Understanding of Data Binding Concepts:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Data Binding:&lt;/strong&gt; While we will explain the concepts of &lt;code&gt;paths&lt;/code&gt; and &lt;code&gt;&amp;lt;ui-bind&amp;gt;&lt;/code&gt; in detail, having a foundational understanding of data binding in web development will help you grasp these concepts more efficiently. Data binding involves synchronizing data between the model and the view, and is crucial for creating dynamic and interactive web applications.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;7 &lt;strong&gt;Basic Knowledge of jQuery:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;jQuery:&lt;/strong&gt; The projects use jQuery for simplifying DOM manipulation and handling events. Basic knowledge of jQuery, including how to select elements, handle events, and manipulate the DOM, will be beneficial. If you’re unfamiliar with jQuery, you might want to review its documentation or tutorials.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;By ensuring you meet these prerequisites, you’ll be well-prepared to follow the tutorial and effectively implement the concepts of &lt;code&gt;paths&lt;/code&gt; and &lt;code&gt;&amp;lt;ui-bind&amp;gt;&lt;/code&gt; in Total.js UI through the provided projects.&lt;/p&gt;
&lt;h2&gt;
  
  
  2. Project 1: User Information Update Form
&lt;/h2&gt;
&lt;h4&gt;
  
  
  Project Overview:
&lt;/h4&gt;

&lt;p&gt;In this first project, we will create a simple form to update user information, such as name and age. The goal is to demonstrate how &lt;code&gt;paths&lt;/code&gt; and &lt;code&gt;&amp;lt;ui-bind&amp;gt;&lt;/code&gt; can be used to link user data to the interface and display it in real-time when updated.&lt;/p&gt;
&lt;h4&gt;
  
  
  Key Features:
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Using &lt;code&gt;paths&lt;/code&gt;&lt;/strong&gt;: &lt;code&gt;Paths&lt;/code&gt; are used to connect the input fields to the user information values (name and age). When a user enters information into the form, these data are directly stored in the associated &lt;code&gt;paths&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Applying &lt;code&gt;&amp;lt;ui-bind&amp;gt;&lt;/code&gt;&lt;/strong&gt;: &lt;code&gt;&amp;lt;ui-bind&amp;gt;&lt;/code&gt; is used to display updated data in real-time. As soon as user information is modified in the form, &lt;code&gt;&amp;lt;ui-bind&amp;gt;&lt;/code&gt; automatically updates the display, showing the new values without requiring a page refresh.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This project showcases the efficiency of Total.js UI for creating dynamic interfaces where data and display remain consistently synchronized.&lt;/p&gt;
&lt;h4&gt;
  
  
  Code:
&lt;/h4&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="cp"&gt;&amp;lt;!DOCTYPE html&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;html&lt;/span&gt; &lt;span class="na"&gt;lang=&lt;/span&gt;&lt;span class="s"&gt;"en"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;head&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;meta&lt;/span&gt; &lt;span class="na"&gt;charset=&lt;/span&gt;&lt;span class="s"&gt;"UTF-8"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;meta&lt;/span&gt; &lt;span class="na"&gt;name=&lt;/span&gt;&lt;span class="s"&gt;"viewport"&lt;/span&gt; &lt;span class="na"&gt;content=&lt;/span&gt;&lt;span class="s"&gt;"width=device-width, initial-scale=1.0"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;title&amp;gt;&lt;/span&gt;TotalJsUi Test&lt;span class="nt"&gt;&amp;lt;/title&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;script &lt;/span&gt;&lt;span class="na"&gt;src=&lt;/span&gt;&lt;span class="s"&gt;"//cdn.componentator.com/spa.min@19.js"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;link&lt;/span&gt; &lt;span class="na"&gt;rel=&lt;/span&gt;&lt;span class="s"&gt;"stylesheet"&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"//cdn.componentator.com/spa.min@19.css"&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;link&lt;/span&gt; &lt;span class="na"&gt;rel=&lt;/span&gt;&lt;span class="s"&gt;"stylesheet"&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"https://cdn.jsdelivr.net/npm/@picocss/pico@2/css/pico.min.css"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/head&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;body&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"container"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;h1&amp;gt;&lt;/span&gt;Update User Information&lt;span class="nt"&gt;&amp;lt;/h1&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;form&lt;/span&gt; &lt;span class="na"&gt;id=&lt;/span&gt;&lt;span class="s"&gt;"userInfoForm"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;label&lt;/span&gt; &lt;span class="na"&gt;for=&lt;/span&gt;&lt;span class="s"&gt;"userName"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Name:&lt;span class="nt"&gt;&amp;lt;/label&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;input&lt;/span&gt; &lt;span class="na"&gt;type=&lt;/span&gt;&lt;span class="s"&gt;"text"&lt;/span&gt; &lt;span class="na"&gt;id=&lt;/span&gt;&lt;span class="s"&gt;"userName"&lt;/span&gt; &lt;span class="na"&gt;placeholder=&lt;/span&gt;&lt;span class="s"&gt;"Enter your name"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;

        &lt;span class="nt"&gt;&amp;lt;label&lt;/span&gt; &lt;span class="na"&gt;for=&lt;/span&gt;&lt;span class="s"&gt;"userAge"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Age:&lt;span class="nt"&gt;&amp;lt;/label&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;input&lt;/span&gt; &lt;span class="na"&gt;type=&lt;/span&gt;&lt;span class="s"&gt;"text"&lt;/span&gt; &lt;span class="na"&gt;id=&lt;/span&gt;&lt;span class="s"&gt;"userAge"&lt;/span&gt; &lt;span class="na"&gt;placeholder=&lt;/span&gt;&lt;span class="s"&gt;"Enter your age"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;/form&amp;gt;&lt;/span&gt;

    &lt;span class="nt"&gt;&amp;lt;h2&amp;gt;&lt;/span&gt;Summary:&lt;span class="nt"&gt;&amp;lt;/h2&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;p&amp;gt;&lt;/span&gt;Name: &lt;span class="nt"&gt;&amp;lt;ui-bind&lt;/span&gt; &lt;span class="na"&gt;path=&lt;/span&gt;&lt;span class="s"&gt;"user.name"&lt;/span&gt; &lt;span class="na"&gt;config=&lt;/span&gt;&lt;span class="s"&gt;"text"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/ui-bind&amp;gt;&amp;lt;/p&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;p&amp;gt;&lt;/span&gt;Age: &lt;span class="nt"&gt;&amp;lt;ui-bind&lt;/span&gt; &lt;span class="na"&gt;path=&lt;/span&gt;&lt;span class="s"&gt;"user.age"&lt;/span&gt; &lt;span class="na"&gt;config=&lt;/span&gt;&lt;span class="s"&gt;"text"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/ui-bind&amp;gt;&amp;lt;/p&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;script&amp;gt;&lt;/span&gt;
        &lt;span class="c1"&gt;// Initialize user data with SET&lt;/span&gt;
        &lt;span class="nc"&gt;SET&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;user.name&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;''&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="nc"&gt;SET&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;user.age&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;''&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
         &lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;nameinput&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;$&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;#userName&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
         &lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;ageinput&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;$&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;#userAge&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

        &lt;span class="c1"&gt;// Function to update user information&lt;/span&gt;
       &lt;span class="nf"&gt;$&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;input#userName&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;on&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;input&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;event&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;

            &lt;span class="nc"&gt;SET&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;user.name&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nf"&gt;$&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;val&lt;/span&gt;&lt;span class="p"&gt;());&lt;/span&gt;

        &lt;span class="p"&gt;});&lt;/span&gt;
         &lt;span class="nf"&gt;$&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;input#userAge&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;on&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;input&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;event&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;

            &lt;span class="nc"&gt;SET&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;user.age&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nf"&gt;$&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;val&lt;/span&gt;&lt;span class="p"&gt;());&lt;/span&gt;

        &lt;span class="p"&gt;});&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/body&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/html&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h3&gt;
  
  
  Result preview
&lt;/h3&gt;

&lt;p&gt;&lt;a href="/download/B20240812T000001233_600x641.gif" class="article-body-image-wrapper"&gt;&lt;img src="/download/B20240812T000001233_600x641.gif" alt="Animated data being sync with form"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This project demonstrates how &lt;code&gt;paths&lt;/code&gt; and &lt;code&gt;&amp;lt;ui-bind&amp;gt;&lt;/code&gt; enable the creation of dynamic interfaces with Total.js UI, where the display remains constantly synchronized with the data.&lt;/p&gt;
&lt;h2&gt;
  
  
  3. Project 2: To-Do List
&lt;/h2&gt;
&lt;h4&gt;
  
  
  Project Overview:
&lt;/h4&gt;

&lt;p&gt;In this second project, we will build a dynamic To-Do List. The goal is to demonstrate how &lt;code&gt;paths&lt;/code&gt; can be manipulated to manage a list of items, and how &lt;code&gt;&amp;lt;ui-bind&amp;gt;&lt;/code&gt; can be used to make tasks interactive, with actions such as marking a task as completed or removing it.&lt;/p&gt;
&lt;h4&gt;
  
  
  Key Features:
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Manipulation of &lt;code&gt;paths&lt;/code&gt;&lt;/strong&gt;: &lt;code&gt;paths&lt;/code&gt; are used to manage the list of tasks. Each task is stored in an array linked to a &lt;code&gt;path&lt;/code&gt; (&lt;code&gt;tasks&lt;/code&gt;), which facilitates adding, modifying, and removing tasks.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Usage of &lt;code&gt;&amp;lt;ui-bind&amp;gt;&lt;/code&gt;&lt;/strong&gt;: &lt;code&gt;&amp;lt;ui-bind&amp;gt;&lt;/code&gt; is used to display the list of tasks and to allow direct interactions with them. Users can mark a task as completed or remove it, and these actions are immediately reflected in the interface thanks to the updates to the &lt;code&gt;paths&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Here is the code for this project:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="cp"&gt;&amp;lt;!DOCTYPE html&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;html&lt;/span&gt; &lt;span class="na"&gt;lang=&lt;/span&gt;&lt;span class="s"&gt;"en"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;head&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;meta&lt;/span&gt; &lt;span class="na"&gt;charset=&lt;/span&gt;&lt;span class="s"&gt;"UTF-8"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;meta&lt;/span&gt; &lt;span class="na"&gt;name=&lt;/span&gt;&lt;span class="s"&gt;"viewport"&lt;/span&gt; &lt;span class="na"&gt;content=&lt;/span&gt;&lt;span class="s"&gt;"width=device-width, initial-scale=1.0"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;title&amp;gt;&lt;/span&gt;Document&lt;span class="nt"&gt;&amp;lt;/title&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;script &lt;/span&gt;&lt;span class="na"&gt;src=&lt;/span&gt;&lt;span class="s"&gt;"//cdn.componentator.com/spa.min@19.js"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;link&lt;/span&gt; &lt;span class="na"&gt;rel=&lt;/span&gt;&lt;span class="s"&gt;"stylesheet"&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"//cdn.componentator.com/spa.min@19.css"&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;link&lt;/span&gt; &lt;span class="na"&gt;rel=&lt;/span&gt;&lt;span class="s"&gt;"stylesheet"&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"https://cdn.jsdelivr.net/npm/@picocss/pico@2/css/pico.min.css"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;style&amp;gt;&lt;/span&gt;
        &lt;span class="nc"&gt;.container&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="nl"&gt;max-width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;600px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
            &lt;span class="nl"&gt;margin&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt; &lt;span class="nb"&gt;auto&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
            &lt;span class="nl"&gt;padding&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;20px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="nf"&gt;#taskForm&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="nl"&gt;display&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;flex&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
            &lt;span class="py"&gt;gap&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;10px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

        &lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="nf"&gt;#taskInput&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="nl"&gt;flex&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
            &lt;span class="nl"&gt;border-radius&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;10px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

        &lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="nf"&gt;#addTaskButton&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;.complete&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;.remove&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="nl"&gt;font-size&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0.9em&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
            &lt;span class="nl"&gt;padding&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;5px&lt;/span&gt; &lt;span class="m"&gt;10px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="nf"&gt;#addTaskButton&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="nl"&gt;white-space&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;nowrap&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="nc"&gt;.remove&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="nl"&gt;background-color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="no"&gt;red&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
            &lt;span class="nl"&gt;color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="no"&gt;white&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
            &lt;span class="nl"&gt;border-color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="no"&gt;white&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="nc"&gt;.complete&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="nl"&gt;color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="no"&gt;white&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
            &lt;span class="nl"&gt;border-color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="no"&gt;white&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="nt"&gt;article&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="nl"&gt;display&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;flex&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
            &lt;span class="nl"&gt;align-items&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;center&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
            &lt;span class="nl"&gt;justify-content&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;space-between&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
            &lt;span class="nl"&gt;margin-bottom&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;10px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
            &lt;span class="nl"&gt;padding&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;10px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
            &lt;span class="nl"&gt;border&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1px&lt;/span&gt; &lt;span class="nb"&gt;solid&lt;/span&gt; &lt;span class="m"&gt;#ddd&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
            &lt;span class="nl"&gt;border-radius&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;10px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;

        &lt;span class="nt"&gt;article&lt;/span&gt;&lt;span class="nc"&gt;.disabled&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nl"&gt;opacity&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;.5&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nl"&gt;background-color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;#ddd&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;/style&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/head&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;body&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"container"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;h1&amp;gt;&lt;/span&gt;To do list&lt;span class="nt"&gt;&amp;lt;/h1&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;id=&lt;/span&gt;&lt;span class="s"&gt;"taskForm"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
            &lt;span class="nt"&gt;&amp;lt;input&lt;/span&gt; &lt;span class="na"&gt;type=&lt;/span&gt;&lt;span class="s"&gt;"text"&lt;/span&gt; &lt;span class="na"&gt;id=&lt;/span&gt;&lt;span class="s"&gt;"taskInput"&lt;/span&gt; &lt;span class="na"&gt;placeholder=&lt;/span&gt;&lt;span class="s"&gt;"New task"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
            &lt;span class="nt"&gt;&amp;lt;button&lt;/span&gt; &lt;span class="na"&gt;type=&lt;/span&gt;&lt;span class="s"&gt;"button"&lt;/span&gt; &lt;span class="na"&gt;id=&lt;/span&gt;&lt;span class="s"&gt;"addTaskButton"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Add Task&lt;span class="nt"&gt;&amp;lt;/button&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;id=&lt;/span&gt;&lt;span class="s"&gt;"taskList"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
            &lt;span class="nt"&gt;&amp;lt;ui-bind&lt;/span&gt; &lt;span class="na"&gt;path=&lt;/span&gt;&lt;span class="s"&gt;"tasks"&lt;/span&gt; &lt;span class="na"&gt;config=&lt;/span&gt;&lt;span class="s"&gt;"template"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
                &lt;span class="nt"&gt;&amp;lt;template&amp;gt;&lt;/span&gt;
                    {{foreach task in value }}
                    &lt;span class="nt"&gt;&amp;lt;article&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"{{ if task.completed }} disabled {{ fi }}"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
                        &lt;span class="nt"&gt;&amp;lt;span&amp;gt;&lt;/span&gt;{{ task.text }}&lt;span class="nt"&gt;&amp;lt;/span&amp;gt;&lt;/span&gt;
                        &lt;span class="nt"&gt;&amp;lt;div&amp;gt;&lt;/span&gt;
                            &lt;span class="nt"&gt;&amp;lt;button&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"complete"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;{{ if task.completed }} Reopen {{ else }} Close{{ fi }} &lt;span class="nt"&gt;&amp;lt;/button&amp;gt;&lt;/span&gt;
                            &lt;span class="nt"&gt;&amp;lt;button&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"remove"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Remove&lt;span class="nt"&gt;&amp;lt;/button&amp;gt;&lt;/span&gt;
                        &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
                    &lt;span class="nt"&gt;&amp;lt;/article&amp;gt;&lt;/span&gt;
                    {{end}}
                &lt;span class="nt"&gt;&amp;lt;/template&amp;gt;&lt;/span&gt;
            &lt;span class="nt"&gt;&amp;lt;/ui-bind&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;script&amp;gt;&lt;/span&gt;
        &lt;span class="c1"&gt;// Initialize the tasks list with SET&lt;/span&gt;
        &lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;tasks&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
            &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;text&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Learn Total.js UI&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;completed&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
            &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;text&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Build a To-Do List&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;completed&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
        &lt;span class="p"&gt;];&lt;/span&gt;
        &lt;span class="nc"&gt;SET&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;tasks&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;tasks&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

        &lt;span class="c1"&gt;// Add a new task&lt;/span&gt;
        &lt;span class="nf"&gt;$&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;#addTaskButton&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;on&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;click&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;taskText&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;$&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;#taskInput&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;val&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
            &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;taskText&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;trim&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;!==&lt;/span&gt; &lt;span class="dl"&gt;''&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
                &lt;span class="nx"&gt;tasks&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;push&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;text&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;taskText&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;completed&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;
                &lt;span class="nc"&gt;SET&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;tasks&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;tasks&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
                &lt;span class="nf"&gt;$&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;#taskInput&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;val&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;''&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
            &lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="p"&gt;});&lt;/span&gt;

        &lt;span class="c1"&gt;// Complete or remove a task&lt;/span&gt;
        &lt;span class="nf"&gt;$&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;#taskList&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;on&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;click&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;event&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;target&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;event&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;target&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
            &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;target&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;classList&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;contains&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;complete&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="nx"&gt;target&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;classList&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;contains&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;remove&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
                &lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;article&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;target&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;closest&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;article&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
                &lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;index&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;Array&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;from&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;article&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;parentNode&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;children&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;indexOf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;article&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
                &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;target&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;classList&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;contains&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;complete&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
                    &lt;span class="nx"&gt;tasks&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;index&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="nx"&gt;completed&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nx"&gt;tasks&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;index&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="nx"&gt;completed&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
                    &lt;span class="nc"&gt;SET&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;tasks&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;tasks&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
                &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;target&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;classList&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;contains&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;remove&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
                    &lt;span class="nx"&gt;tasks&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;splice&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;index&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
                    &lt;span class="nc"&gt;SET&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;tasks&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;tasks&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
                &lt;span class="p"&gt;}&lt;/span&gt;
            &lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="p"&gt;});&lt;/span&gt;
        &lt;span class="nf"&gt;$&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;body&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;keyup&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;function &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;event&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;event&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;keyCode&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="mi"&gt;13&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
                &lt;span class="nf"&gt;$&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;#addTaskButton&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;click&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
        &lt;span class="p"&gt;});&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/body&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/html&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Result preview
&lt;/h3&gt;

&lt;p&gt;&lt;a href="/download/B20240812T000001234_600x641.gif" class="article-body-image-wrapper"&gt;&lt;img src="/download/B20240812T000001234_600x641.gif" alt="todo-ezgif.com-video-to-gif-converter.gif"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This project illustrates how to use &lt;code&gt;paths&lt;/code&gt; to manage a dynamic list and how &lt;code&gt;&amp;lt;ui-bind&amp;gt;&lt;/code&gt; can be employed to create interactive interfaces with Total.js UI.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;In this tutorial, we explored two small projects that highlight the use of &lt;code&gt;paths&lt;/code&gt; and &lt;code&gt;&amp;lt;ui-bind&amp;gt;&lt;/code&gt; in Total.js UI. These concepts are fundamental for creating reactive and dynamic interfaces.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Importance of Paths&lt;/strong&gt;: &lt;code&gt;Paths&lt;/code&gt; allow you to link data to user interface elements. They are essential for managing states and real-time updates.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Usage of &lt;code&gt;&amp;lt;ui-bind&amp;gt;&lt;/code&gt;&lt;/strong&gt;: The &lt;code&gt;&amp;lt;ui-bind&amp;gt;&lt;/code&gt; is a powerful feature of Total.js UI that synchronizes data with the user interface, providing a smooth and interactive experience.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;By mastering these concepts through projects like the user information update form and the To-Do List, you have gained a solid understanding of the basics of Total.js UI.&lt;/p&gt;

&lt;p&gt;I encourage you to continue exploring Total.js UI by experimenting with other projects. The more familiar you become with these concepts, the better you'll be able to create complex and efficient applications. Feel free to test different configurations, combine features, and explore the Total.js UI documentation to deepen your knowledge.&lt;/p&gt;

</description>
      <category>totaljs</category>
      <category>totaljsui</category>
      <category>frontend</category>
      <category>jquery</category>
    </item>
    <item>
      <title>Beginner Guide to Total.js UI: #02 Understanding Paths</title>
      <dc:creator>Louis Bertson</dc:creator>
      <pubDate>Wed, 07 Aug 2024 22:03:06 +0000</pubDate>
      <link>https://dev.to/louis_bertson_1124e9cdc59/beginner-guide-to-totaljs-ui-02-understanding-paths-351h</link>
      <guid>https://dev.to/louis_bertson_1124e9cdc59/beginner-guide-to-totaljs-ui-02-understanding-paths-351h</guid>
      <description>&lt;p&gt;Welcome back to our series on mastering &lt;strong&gt;Total.js UI&lt;/strong&gt;! If you’ve been following along, you should have already completed the installation and setup of &lt;strong&gt;Total.js UI&lt;/strong&gt;, giving you a solid foundation to work with. In this post, we’re diving into one of the most crucial concepts in &lt;strong&gt;Total.js UI&lt;/strong&gt;: &lt;em&gt;Paths&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;Paths are like the roadmap of your application. They help you navigate through your data, manage functions, and control actions with precision. If you’re a front-end developer coming from other frameworks like &lt;a href="https://react.dev/" rel="noopener noreferrer"&gt;React&lt;/a&gt;, &lt;a href="https://angular.dev/" rel="noopener noreferrer"&gt;Angular&lt;/a&gt;, or &lt;a href="https://vuejs.org/" rel="noopener noreferrer"&gt;Vue&lt;/a&gt;, you’ll find that paths in &lt;strong&gt;Total.js UI&lt;/strong&gt; offer a unique and powerful way to handle your application's state and behavior.&lt;/p&gt;

&lt;p&gt;This blog post is aimed at developers who are just getting started with &lt;strong&gt;Total.js UI&lt;/strong&gt;. Whether you’re transitioning from other popular frameworks or are entirely new to the concept, this guide will walk you through the essentials of paths in &lt;strong&gt;Total.js UI&lt;/strong&gt;, ensuring you’re well-equipped to start building dynamic and interactive web applications.&lt;/p&gt;

&lt;h2&gt;
  
  
  What are Paths in &lt;strong&gt;Total.js UI&lt;/strong&gt;?
&lt;/h2&gt;

&lt;p&gt;In &lt;strong&gt;Total.js UI&lt;/strong&gt;, paths are akin to addresses in a real-world &lt;strong&gt;postal system&lt;/strong&gt;. Just as you use an address to send a letter to the correct location, paths in &lt;strong&gt;Total.js UI&lt;/strong&gt; guide your data and functions to their correct destination within your application. They are the foundation for creating organized and maintainable code, allowing you to easily access and modify data.&lt;/p&gt;

&lt;p&gt;For example, imagine you're sending a package. You need the correct address (path) to ensure it arrives at the right place. Similarly, in &lt;strong&gt;Total.js UI&lt;/strong&gt;, paths help you locate and manipulate specific pieces of data or functions. Without paths, managing data in your application would be like trying to deliver a package without an address—nearly impossible.&lt;/p&gt;

&lt;h2&gt;
  
  
  Types of Paths
&lt;/h2&gt;

&lt;p&gt;Paths in &lt;strong&gt;Total.js UI&lt;/strong&gt; come in various forms, each suited to different scenarios. Understanding these types is essential for effectively managing data and actions in your applications.&lt;/p&gt;

&lt;h4&gt;
  
  
  Absolute Paths
&lt;/h4&gt;

&lt;p&gt;Absolute paths are the full addresses of your data or functions. They point directly to the exact location, leaving no room for ambiguity.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Real-Life Example:&lt;/strong&gt; &lt;br&gt;
Think of absolute paths like mailing a letter to a specific house number in a city. No matter where you are, the letter will always reach the intended house because the address is complete and specific.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Code Example:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nc"&gt;SET&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;users.form.age&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;30&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here, &lt;code&gt;users.form.age&lt;/code&gt; is an absolute path that directly references the &lt;code&gt;age&lt;/code&gt; property in the &lt;code&gt;users.form&lt;/code&gt; object. No matter where in your application you are, this path will always lead to the &lt;code&gt;age&lt;/code&gt; property of the &lt;code&gt;users.form&lt;/code&gt;.&lt;/p&gt;

&lt;h4&gt;
  
  
  Relative Paths
&lt;/h4&gt;

&lt;p&gt;Relative paths are like giving directions relative to a landmark rather than a specific address. They are defined concerning the current context or scope, making them more flexible and dynamic.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Real-Life Example:&lt;/strong&gt;&lt;br&gt;
Imagine giving directions by saying, "Turn left at the grocery store," rather than specifying the exact street name. The directions change depending on where the person is starting, but they still lead to the intended destination.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Code Example:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nc"&gt;SET&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;?.age&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;30&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this case, &lt;code&gt;?.age&lt;/code&gt; is a relative path that depends on the current scope. The exact location of &lt;code&gt;age&lt;/code&gt; depends on the context in which this code is executed.&lt;/p&gt;

&lt;h4&gt;
  
  
  Explicit and Implicit Paths
&lt;/h4&gt;

&lt;p&gt;Paths can be either explicitly declared or implicitly inferred, depending on how they are defined in your code.&lt;/p&gt;

&lt;h4&gt;
  
  
  Explicit Paths
&lt;/h4&gt;

&lt;p&gt;Explicit paths are those you define directly in your code, making your intentions clear and your code easy to read.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Real-Life Example:&lt;/strong&gt;&lt;br&gt;
Think of explicitly writing down an address on an envelope before sending a letter. It’s clear, deliberate, and leaves no room for confusion.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Code Example:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;script&amp;gt;&lt;/span&gt;
    &lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;mypath&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Hello world&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here, &lt;code&gt;mypath&lt;/code&gt; is an explicitly declared path. You can easily reference this path throughout your script, just as you would use a clearly written address to send a letter.&lt;/p&gt;

&lt;h4&gt;
  
  
  Implicit Paths
&lt;/h4&gt;

&lt;p&gt;Implicit paths are inferred from DOM elements, typically using attributes like &lt;code&gt;id&lt;/code&gt;. They are automatically available, making them convenient but sometimes less clear.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Real-Life Example:&lt;/strong&gt;&lt;br&gt;
This is like relying on a known landmark to identify a location, such as "the house with the red door." While convenient, it might not be as clear to someone unfamiliar with the area.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Code Example:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;li&lt;/span&gt; &lt;span class="na"&gt;id=&lt;/span&gt;&lt;span class="s"&gt;"mypath"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this case, &lt;code&gt;mypath&lt;/code&gt; is an implicitly declared path, available for use without needing an explicit declaration in your JavaScript.&lt;/p&gt;

&lt;h3&gt;
  
  
  Scoped Paths
&lt;/h3&gt;

&lt;p&gt;Scoped paths use the &lt;code&gt;?&lt;/code&gt; character to refer to data within the nearest enclosing scope. This allows for concise and context-sensitive paths.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Real-Life Example:&lt;/strong&gt;&lt;br&gt;
Imagine you’re at a large family gathering, and someone says, “Could you pass the salt?” You know they mean the salt shaker on the nearest table, not one in the kitchen or elsewhere. The context determines the scope.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Code Example:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;ui-plugin&lt;/span&gt; &lt;span class="na"&gt;path=&lt;/span&gt;&lt;span class="s"&gt;"obj"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;ui-bind&lt;/span&gt; &lt;span class="na"&gt;path=&lt;/span&gt;&lt;span class="s"&gt;"?.message"&lt;/span&gt; &lt;span class="na"&gt;config=&lt;/span&gt;&lt;span class="s"&gt;"text"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/ui-bind&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/ui-plugin&amp;gt;&lt;/span&gt;

&lt;span class="nt"&gt;&amp;lt;script&amp;gt;&lt;/span&gt;
    &lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;obj&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;message&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Hello world&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;};&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here, &lt;code&gt;?.message&lt;/code&gt; is a scoped path. It dynamically refers to the &lt;code&gt;message&lt;/code&gt; property within the current scope defined by the &lt;code&gt;ui-plugin&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Temporary Paths
&lt;/h3&gt;

&lt;p&gt;Temporary paths, prefixed with &lt;code&gt;%&lt;/code&gt;, are used for transient data that doesn’t need to persist. They are perfect for short-lived data such as user inputs or temporary calculations.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Real-Life Example:&lt;/strong&gt;&lt;br&gt;
Consider a Post-it note. You jot down a quick reminder, but it’s not meant to be kept forever. It’s temporary, just like data stored in a temporary path.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Code Example:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nc"&gt;SET&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;%search&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;example search&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This creates a temporary path for &lt;code&gt;search&lt;/code&gt;, storing it in a transient context. This path is perfect for data that doesn’t need to persist beyond the current session or interaction.&lt;/p&gt;

&lt;h2&gt;
  
  
  Using GET and SET with Paths
&lt;/h2&gt;

&lt;p&gt;Paths in &lt;strong&gt;Total.js UI&lt;/strong&gt; work hand-in-hand with the &lt;code&gt;GET&lt;/code&gt; and &lt;code&gt;SET&lt;/code&gt; methods, which allow you to retrieve or update data stored at specific paths.&lt;/p&gt;

&lt;h3&gt;
  
  
  SET Method
&lt;/h3&gt;

&lt;p&gt;The &lt;code&gt;SET&lt;/code&gt; method is like mailing a package to a specific address—you are sending data to a specific path within your application.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nc"&gt;SET&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;users.form.age&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;30&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this example, &lt;code&gt;SET&lt;/code&gt; assigns the value &lt;code&gt;30&lt;/code&gt; to &lt;code&gt;users.form.age&lt;/code&gt;. It’s akin to delivering a package directly to someone’s house.&lt;/p&gt;

&lt;h3&gt;
  
  
  GET Method
&lt;/h3&gt;

&lt;p&gt;The &lt;code&gt;GET&lt;/code&gt; method is like checking your mailbox—you retrieve the data that has been sent to a specific path.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;GET&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;common.page&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This retrieves the data stored at &lt;code&gt;common.page&lt;/code&gt; and logs it to the console, just like reading a letter that arrived in your mailbox.&lt;/p&gt;

&lt;h2&gt;
  
  
  Watching Changes in Paths
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;WATCH&lt;/code&gt; method in &lt;strong&gt;Total.js UI&lt;/strong&gt; allows you to observe changes in specific paths and react to them in real-time. It’s like having a security camera that alerts you whenever someone arrives at your door—you get notified whenever there’s a change.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nc"&gt;WATCH&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;path.to.model&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;path&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;type&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;NEW VALUE&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this example, the &lt;code&gt;WATCH&lt;/code&gt; method monitors changes at &lt;code&gt;path.to.model&lt;/code&gt; and executes a function whenever the value changes, logging the new value.&lt;/p&gt;

&lt;h2&gt;
  
  
  Video Tutorial
&lt;/h2&gt;

&lt;p&gt;To complement this blog post, we’ve prepared a video tutorial that covers everything you need to know about paths in &lt;strong&gt;Total.js UI&lt;/strong&gt;. In the video, we walk you through each concept with practical examples, making it easier to understand and apply these ideas in your projects.&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/lSJXJ7Ums8U"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;This video is an excellent resource for visual learners and those who prefer to see the concepts in action. Don't forget to subscribe to our YouTube channel for more tutorials in this series!&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Paths are the backbone of data management in &lt;strong&gt;Total.js UI&lt;/strong&gt;. By understanding the different types of paths and how to use them, you’ll be able to navigate through your data with ease, making your applications more dynamic and responsive.&lt;/p&gt;

&lt;p&gt;In this post, we covered the basics of paths, including absolute, relative, explicit, implicit, scoped, and temporary paths. We also explored how to use &lt;code&gt;GET&lt;/code&gt; and &lt;code&gt;SET&lt;/code&gt; to manipulate data and how to use &lt;code&gt;WATCH&lt;/code&gt; to observe changes in real-time.&lt;/p&gt;

&lt;p&gt;Mastering paths will open up new possibilities for your &lt;strong&gt;Total.js UI&lt;/strong&gt; projects, giving you the tools you need to create robust, maintainable applications. In the next post, we’ll dive deeper into binding and how it interacts with paths to create even more powerful UIs. Stay tuned!&lt;/p&gt;

</description>
      <category>total</category>
      <category>totaljs</category>
      <category>totaljsui</category>
      <category>frontend</category>
    </item>
    <item>
      <title>Beginner Guide to Total.js UI: #01 Installation and Setup</title>
      <dc:creator>Louis Bertson</dc:creator>
      <pubDate>Mon, 05 Aug 2024 09:14:42 +0000</pubDate>
      <link>https://dev.to/louis_bertson_1124e9cdc59/beginner-guide-to-totaljs-ui-01-installation-and-setup-2i81</link>
      <guid>https://dev.to/louis_bertson_1124e9cdc59/beginner-guide-to-totaljs-ui-01-installation-and-setup-2i81</guid>
      <description>&lt;h3&gt;
  
  
  Introduction
&lt;/h3&gt;

&lt;p&gt;Welcome to the first post in our series on mastering &lt;strong&gt;Total.js UI&lt;/strong&gt;. In this series, we will guide you through the fundamentals of &lt;strong&gt;Total.js UI&lt;/strong&gt;, empowering you to create robust and dynamic Single Page Applications (SPAs) with ease. Whether you are a complete beginner or an experienced developer looking to expand your toolkit, this guide is designed to help you get started with &lt;strong&gt;Total.js UI&lt;/strong&gt; from scratch.&lt;/p&gt;

&lt;p&gt;In this initial post, we will focus on the prerequisites and the installation process of &lt;strong&gt;Total.js UI&lt;/strong&gt;. By the end of this guide, you will have a working environment ready to explore and develop with &lt;strong&gt;Total.js UI&lt;/strong&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  What is &lt;strong&gt;Total.js UI&lt;/strong&gt;?
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Total.js UI&lt;/strong&gt; is a powerful client-side library designed to simplify the creation of reusable UI components. It offers a comprehensive set of features tailored for building SPAs, making it a versatile choice for front-end development. &lt;strong&gt;Total.js UI&lt;/strong&gt; stands out due to its ease of use, minimal dependencies, and a rich collection of pre-built components.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why Choose &lt;strong&gt;Total.js UI&lt;/strong&gt;?
&lt;/h3&gt;

&lt;p&gt;Here are a few reasons why &lt;strong&gt;Total.js UI&lt;/strong&gt; might be the perfect fit for your next project:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Simplicity&lt;/strong&gt;: &lt;strong&gt;Total.js UI&lt;/strong&gt; is straightforward to use, even for beginners. Its path-based system for managing data and actions reduces complexity.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Reusability&lt;/strong&gt;: The library focuses on creating reusable web components, ensuring that your code is modular and maintainable.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Lightweight&lt;/strong&gt;: With minimal dependencies and small file sizes, &lt;strong&gt;Total.js UI&lt;/strong&gt; ensures that your applications remain fast and responsive.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Comprehensive Components&lt;/strong&gt;: It includes a variety of UI components and icons that you can integrate into your projects effortlessly.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Community and Support&lt;/strong&gt;: &lt;strong&gt;Total.js UI&lt;/strong&gt; has an active community, free online chat support, and commercial support options to help you whenever needed.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Prerequisites
&lt;/h3&gt;

&lt;p&gt;Before diving into the installation process, ensure that you have the following prerequisites in place:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Basic Knowledge of HTML, CSS, and JavaScript&lt;/strong&gt;: Familiarity with these technologies is essential as &lt;strong&gt;Total.js UI&lt;/strong&gt; builds upon them.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A Code Editor&lt;/strong&gt;: Use any code editor you are comfortable with. Popular choices include Visual Studio Code, Sublime Text, and Atom.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A Web Browser&lt;/strong&gt;: Any modern web browser will work. Chrome, Firefox, and Edge are good options.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Installing &lt;strong&gt;Total.js UI&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;The installation of &lt;strong&gt;Total.js UI&lt;/strong&gt; is straightforward and can be done in a few simple steps. You have two main options for installation: using a Content Delivery Network (CDN) or downloading the library files directly.&lt;/p&gt;

&lt;h4&gt;
  
  
  Option 1: Using a CDN
&lt;/h4&gt;

&lt;p&gt;Using a CDN is the easiest and quickest way to get started with &lt;strong&gt;Total.js UI&lt;/strong&gt;. It requires no additional setup and ensures that you are always using the latest version of the library.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Include the JS and CSS Files&lt;/strong&gt;: Add the following script and link tags to the &lt;code&gt;&amp;lt;head&amp;gt;&lt;/code&gt; section of your HTML file:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="cp"&gt;&amp;lt;!DOCTYPE html&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;html&lt;/span&gt; &lt;span class="na"&gt;lang=&lt;/span&gt;&lt;span class="s"&gt;"en"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;head&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;meta&lt;/span&gt; &lt;span class="na"&gt;charset=&lt;/span&gt;&lt;span class="s"&gt;"UTF-8"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;meta&lt;/span&gt; &lt;span class="na"&gt;name=&lt;/span&gt;&lt;span class="s"&gt;"viewport"&lt;/span&gt; &lt;span class="na"&gt;content=&lt;/span&gt;&lt;span class="s"&gt;"width=device-width, initial-scale=1.0"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;title&amp;gt;&lt;/span&gt;__Total.js UI__ Example&lt;span class="nt"&gt;&amp;lt;/title&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;script &lt;/span&gt;&lt;span class="na"&gt;src=&lt;/span&gt;&lt;span class="s"&gt;"https://cdn.componentator.com/spa.min@20.js"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;link&lt;/span&gt; &lt;span class="na"&gt;rel=&lt;/span&gt;&lt;span class="s"&gt;"stylesheet"&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"https://cdn.componentator.com/spa.min@20.css"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/head&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;body&amp;gt;&lt;/span&gt;
    &lt;span class="c"&gt;&amp;lt;!-- Your content here --&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/body&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/html&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;These tags load the &lt;strong&gt;Total.js UI&lt;/strong&gt; JavaScript and CSS files from the CDN, making them available for use in your project.&lt;/p&gt;

&lt;h4&gt;
  
  
  Option 2: Downloading the Library Files
&lt;/h4&gt;

&lt;p&gt;If you prefer to have a local copy of the library files, you can download them from the official website.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Download the Files&lt;/strong&gt;: Visit the &lt;a href="https://github.com/totaljs/jComponent/" rel="noopener noreferrer"&gt;&lt;strong&gt;Total.js UI&lt;/strong&gt; library on Github&lt;/a&gt; and download the latest versions of &lt;code&gt;spa.min.js&lt;/code&gt; and &lt;code&gt;spa.min.css&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Include the Files in Your Project&lt;/strong&gt;: Place the downloaded files in a directory within your project, for example, in a folder named &lt;code&gt;libs&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Reference the Files&lt;/strong&gt;: Add the following script and link tags to the &lt;code&gt;&amp;lt;head&amp;gt;&lt;/code&gt; section of your HTML file, adjusting the paths as necessary:&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="cp"&gt;&amp;lt;!DOCTYPE html&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;html&lt;/span&gt; &lt;span class="na"&gt;lang=&lt;/span&gt;&lt;span class="s"&gt;"en"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;head&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;meta&lt;/span&gt; &lt;span class="na"&gt;charset=&lt;/span&gt;&lt;span class="s"&gt;"UTF-8"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;meta&lt;/span&gt; &lt;span class="na"&gt;name=&lt;/span&gt;&lt;span class="s"&gt;"viewport"&lt;/span&gt; &lt;span class="na"&gt;content=&lt;/span&gt;&lt;span class="s"&gt;"width=device-width, initial-scale=1.0"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;title&amp;gt;&lt;/span&gt;__Total.js UI__ Example&lt;span class="nt"&gt;&amp;lt;/title&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;script &lt;/span&gt;&lt;span class="na"&gt;src=&lt;/span&gt;&lt;span class="s"&gt;"libs/spa.min.js"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;link&lt;/span&gt; &lt;span class="na"&gt;rel=&lt;/span&gt;&lt;span class="s"&gt;"stylesheet"&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"libs/spa.min.css"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/head&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;body&amp;gt;&lt;/span&gt;
    &lt;span class="c"&gt;&amp;lt;!-- Your content here --&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/body&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/html&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Verifying the Installation
&lt;/h3&gt;

&lt;p&gt;After including the &lt;strong&gt;Total.js UI&lt;/strong&gt; library in your project, you can verify the installation by adding a simple UI component. Let's add a basic component to ensure everything is working correctly.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Create a Simple Component&lt;/strong&gt;: Add the following HTML code inside the &lt;code&gt;&amp;lt;body&amp;gt;&lt;/code&gt; tag of your HTML file:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;ui-bind&lt;/span&gt; &lt;span class="na"&gt;path=&lt;/span&gt;&lt;span class="s"&gt;"badgeValue"&lt;/span&gt; &lt;span class="na"&gt;config=&lt;/span&gt;&lt;span class="s"&gt;"text"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/ui-bind&amp;gt;&lt;/span&gt;

&lt;span class="nt"&gt;&amp;lt;script&amp;gt;&lt;/span&gt;
    &lt;span class="nc"&gt;SET&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;badgeValue&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Hello __Total.js UI__!&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Run Your Project&lt;/strong&gt;: Open your HTML file in a web browser. You should see a badge displaying the text "Hello &lt;strong&gt;Total.js UI&lt;/strong&gt;!".&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Video Tutorial
&lt;/h2&gt;

&lt;p&gt;To complement this blog post, we’ve prepared a video tutorial that covers everything you need to know about paths in Total.js UI. In the video, we walk you through each concept with practical examples, making it easier to understand and apply these ideas in your projects.&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/vzS0gzQ4OAo"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;This video is an excellent resource for visual learners and those who prefer to see the concepts in action. Don't forget to subscribe to our YouTube channel for more tutorials in this series!&lt;/p&gt;

&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;Congratulations! You have successfully set up &lt;strong&gt;Total.js UI&lt;/strong&gt; in your project. This marks the beginning of your journey with &lt;strong&gt;Total.js UI&lt;/strong&gt;, a powerful library that will simplify the creation of dynamic and responsive SPAs.&lt;/p&gt;

&lt;p&gt;In this first post, we covered the prerequisites and the installation process, ensuring that your environment is ready for development. In the upcoming posts, we will delve deeper into the various features of &lt;strong&gt;Total.js UI&lt;/strong&gt;, starting with understanding paths, which are fundamental to managing data and actions within your application.&lt;/p&gt;

&lt;p&gt;Stay tuned as we explore more about &lt;strong&gt;Total.js UI&lt;/strong&gt; and help you become an expert in building modern web applications. Happy coding!&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Total.js UI Documentation&lt;/strong&gt;: &lt;a href="https://docs.totaljs.com/components" rel="noopener noreferrer"&gt;https://docs.totaljs.com/components&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Total.js Enterprise&lt;/strong&gt;: &lt;a href="https://www.totaljs.com/enterprise" rel="noopener noreferrer"&gt;Total.js Enterprise&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;GitHub&lt;/strong&gt;: &lt;a href="https://github.com/totaljs" rel="noopener noreferrer"&gt;Total.js on GitHub&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Stack Overflow&lt;/strong&gt;: &lt;a href="https://stackoverflow.com/questions/tagged/total.js" rel="noopener noreferrer"&gt;Total.js questions on Stack Overflow&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Telegram&lt;/strong&gt;: &lt;a href="https://t.me/totaljs" rel="noopener noreferrer"&gt;Total.js Telegram group&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;WhatsApp&lt;/strong&gt;: &lt;a href="https://chat.whatsapp.com/IgyfyySDuOlH3WF1Iqa33o" rel="noopener noreferrer"&gt;Total.js WhatsApp group&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Twitter&lt;/strong&gt;: &lt;a href="https://twitter.com/totalframework" rel="noopener noreferrer"&gt;Total.js on Twitter&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Facebook&lt;/strong&gt;: &lt;a href="https://www.facebook.com/totaljs.web.framework/" rel="noopener noreferrer"&gt;Total.js on Facebook&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;LinkedIn&lt;/strong&gt;: &lt;a href="https://www.linkedin.com/groups/8109884" rel="noopener noreferrer"&gt;Total.js LinkedIn group&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Reddit&lt;/strong&gt;: &lt;a href="https://www.reddit.com/r/totaljs/" rel="noopener noreferrer"&gt;Total.js subreddit&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Discord&lt;/strong&gt;: &lt;a href="https://discord.gg/Vwd6rAp4" rel="noopener noreferrer"&gt;Total.js Discord server&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Slack&lt;/strong&gt;: &lt;a href="https://totaljs.slack.com/" rel="noopener noreferrer"&gt;Total.js Slack channel&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>totaljs</category>
      <category>totaljsui</category>
      <category>webcomponents</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Achieve more with Total.js: introducing Total.js Enterprise</title>
      <dc:creator>Louis Bertson</dc:creator>
      <pubDate>Thu, 11 Jul 2024 01:43:51 +0000</pubDate>
      <link>https://dev.to/louis_bertson_1124e9cdc59/achieve-more-with-totaljs-introducing-totaljs-enterprise-1ipc</link>
      <guid>https://dev.to/louis_bertson_1124e9cdc59/achieve-more-with-totaljs-introducing-totaljs-enterprise-1ipc</guid>
      <description>&lt;p&gt;Staying ahead of the curve requires the right tools and a platform that understands your needs. That's why we are thrilled to introduce our latest video on &lt;a href="https://totaljs.com/enterprise" rel="noopener noreferrer"&gt;&lt;strong&gt;Total.js Enterprise&lt;/strong&gt;&lt;/a&gt;, designed to help developers achieve more. Whether you're a company, a seasoned developer or just starting, Total.js Enterprise offers a comprehensive suite of tools to elevate your projects and streamline your workflow.&lt;/p&gt;

&lt;h3&gt;
  
  
  Discover the Total.js Ecosystem
&lt;/h3&gt;

&lt;p&gt;At the heart of our offering is the &lt;a href="https://totaljs.com" rel="noopener noreferrer"&gt;&lt;strong&gt;Total.js Framework&lt;/strong&gt;&lt;/a&gt;, a powerful, open-source solution that has been empowering developers to create fast, scalable, and secure applications with ease. Imagine building websites, mobile friendly apps, and complex web applications with unparalleled flexibility and robustness. The &lt;strong&gt;Total.js Platform&lt;/strong&gt; builds on this strength, providing a range of tools designed to enhance your development process and deliver exceptional digital experiences.&lt;/p&gt;

&lt;h3&gt;
  
  
  Total.js Enterprise
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Total.js Enterprise&lt;/strong&gt; takes everything you love about the Total.js Platform and amplifies it. This exclusive package is tailored for developers who demand the best in quality and flexibility. Want to know more about the premium open-source content, unlimited use, and 24/7 consulting services? Our video dives deep into how Total.js Enterprise can transform your development process and save you time and resources.&lt;/p&gt;

&lt;h3&gt;
  
  
  An Investment in Innovation
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Total.js Enterprise&lt;/strong&gt; is an investment that pays off by saving you time and resources, allowing you to focus on what you do best—creating innovative applications. Curious about how this cost-effective solution can benefit your projects? I cover all the details in the video.&lt;/p&gt;

&lt;h3&gt;
  
  
  Get Started Today
&lt;/h3&gt;

&lt;p&gt;Getting started with &lt;strong&gt;Total.js Enterprise&lt;/strong&gt; is simple and straightforward. Watch the video to learn how you can join a community of innovators and gain instant access to premium content. See firsthand how Total.js Enterprise can empower you to achieve more.&lt;/p&gt;

&lt;h3&gt;
  
  
  Watch My Video
&lt;/h3&gt;

&lt;p&gt;Ready to see &lt;strong&gt;Total.js Enterprise&lt;/strong&gt; in action? Watch my latest video to discover how this powerful tool can elevate your development experience. Don't miss out on this opportunity to take your projects to the next level.&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/yc2JMtsO3Is"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;From the robust foundation of the &lt;strong&gt;Total.js Framework&lt;/strong&gt; to the comprehensive capabilities of the &lt;strong&gt;Total.js Platform&lt;/strong&gt;, and finally to the premium offerings of &lt;strong&gt;Total.js Enterprise&lt;/strong&gt;, our mission is to empower you to achieve more. Join me on this journey to innovation and elevate your development projects with Total.js Enterprise.&lt;br&gt;
Visit our website &lt;a href="https://totaljs.com/enterprise" rel="noopener noreferrer"&gt;www.totaljs.com/enterprise&lt;/a&gt; to learn more and watch the video to see how you can achieve more with Total.js. Share your thoughts in the comments below and let’s embark on this journey together!&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Total.js Enterprise&lt;/strong&gt;: &lt;a href="https://www.totaljs.com/enterprise" rel="noopener noreferrer"&gt;Total.js Enterprise&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;GitHub&lt;/strong&gt;: &lt;a href="https://github.com/totaljs" rel="noopener noreferrer"&gt;Total.js on GitHub&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Stack Overflow&lt;/strong&gt;: &lt;a href="https://stackoverflow.com/questions/tagged/total.js" rel="noopener noreferrer"&gt;Total.js questions on Stack Overflow&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Telegram&lt;/strong&gt;: &lt;a href="https://t.me/totaljs" rel="noopener noreferrer"&gt;Total.js Telegram group&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;WhatsApp&lt;/strong&gt;: &lt;a href="https://chat.whatsapp.com/IgyfyySDuOlH3WF1Iqa33o" rel="noopener noreferrer"&gt;Total.js WhatsApp group&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Twitter&lt;/strong&gt;: &lt;a href="https://twitter.com/totalframework" rel="noopener noreferrer"&gt;Total.js on Twitter&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Facebook&lt;/strong&gt;: &lt;a href="https://www.facebook.com/totaljs.web.framework/" rel="noopener noreferrer"&gt;Total.js on Facebook&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;LinkedIn&lt;/strong&gt;: &lt;a href="https://www.linkedin.com/groups/8109884" rel="noopener noreferrer"&gt;Total.js LinkedIn group&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Reddit&lt;/strong&gt;: &lt;a href="https://www.reddit.com/r/totaljs/" rel="noopener noreferrer"&gt;Total.js subreddit&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Discord&lt;/strong&gt;: &lt;a href="https://discord.gg/Vwd6rAp4" rel="noopener noreferrer"&gt;Total.js Discord server&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Slack&lt;/strong&gt;: &lt;a href="https://totaljs.slack.com/" rel="noopener noreferrer"&gt;Total.js Slack channel&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>totaljs</category>
      <category>node</category>
      <category>programming</category>
    </item>
    <item>
      <title>Enhancing Your Applications with Total.js v5 Proxy Functionality</title>
      <dc:creator>Louis Bertson</dc:creator>
      <pubDate>Wed, 03 Apr 2024 09:58:15 +0000</pubDate>
      <link>https://dev.to/louis_bertson_1124e9cdc59/enhancing-your-applications-with-totaljs-v5-proxy-functionality-kd4</link>
      <guid>https://dev.to/louis_bertson_1124e9cdc59/enhancing-your-applications-with-totaljs-v5-proxy-functionality-kd4</guid>
      <description>&lt;p&gt;In the rapidly evolving field of web development, microservices are prevalent and their critical importance of high-performing and reliable proxy servers cannot be overstated. &lt;a href="https://blog.totaljs.com/posts/1777745001ty71b/"&gt;My previous exploration&lt;/a&gt; into &lt;strong&gt;Total.js&lt;/strong&gt;, a robust framework for web applications, uncovered its powerful proxy creation capabilities. Since then, &lt;strong&gt;Total.js&lt;/strong&gt; has released version 5, which brings significant updates and improvements to its proxy functionality. Today, I'm excited to delve into these updates, demonstrating how &lt;strong&gt;Total.js&lt;/strong&gt; continues to ease and refine the development process.&lt;/p&gt;

&lt;h2&gt;
  
  
  Reflecting on the Past.
&lt;/h2&gt;

&lt;p&gt;Before diving into the latest updates, let's revisit why &lt;strong&gt;Total.js&lt;/strong&gt; became my favorite tool for creating &lt;strong&gt;proxy servers&lt;/strong&gt;. Its one-line setup, dependency-free nature, and ease of learning stood out amidst a sea of frameworks. &lt;strong&gt;Total.js&lt;/strong&gt; not only promised but also delivered a lightweight, strong, real-time, and reliable solution for my &lt;strong&gt;proxy server&lt;/strong&gt; needs.&lt;/p&gt;

&lt;h2&gt;
  
  
  What's New in &lt;strong&gt;Total.js v5&lt;/strong&gt; Proxy Functionality?
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Total.js v5&lt;/strong&gt; has introduced enhanced proxy functionalities, addressing bugs and expanding capabilities to offer more control and flexibility to developers. Here's what's new:&lt;/p&gt;

&lt;h3&gt;
  
  
  Enhanced control with new methods
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Check Functionality&lt;/strong&gt;: The new &lt;code&gt;.check()&lt;/code&gt; method allows developers to execute custom logic to determine if a request should be proxied. This adds an extra layer of control, enabling use cases like conditional proxying based on request properties.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Pre and Post Processing&lt;/strong&gt;: With &lt;code&gt;.before()&lt;/code&gt; and &lt;code&gt;.after()&lt;/code&gt; methods, developers can now manipulate requests before they're sent and responses before they're returned to the client. This is perfect for adding custom headers, logging, or any form of request/response transformation.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Removing Proxy Routes&lt;/strong&gt;: The &lt;code&gt;.remove()&lt;/code&gt; method provides the ability to dynamically remove proxy routes, offering flexibility in managing proxy behaviors at runtime.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Refined Request Handling with Copy Types
&lt;/h3&gt;

&lt;p&gt;The &lt;code&gt;.copy()&lt;/code&gt; method has been updated to support three modes of operation - &lt;code&gt;none&lt;/code&gt;, &lt;code&gt;replace&lt;/code&gt;, and &lt;code&gt;extend&lt;/code&gt; - providing finer control over how query strings are handled:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;None&lt;/strong&gt;: Retains the original query string of the proxied request.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Replace&lt;/strong&gt;: Clears the original query string, proxying the request without it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Extend&lt;/strong&gt;: Appends the original query string to the proxied path, allowing for extended functionality.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Upgrading Your Proxy Server in &lt;strong&gt;Total.js&lt;/strong&gt; v5
&lt;/h2&gt;

&lt;p&gt;Upgrading your proxy server to leverage these new features is simple. Here's a quick guide to get you started:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Define a proxy route with advanced control&lt;/span&gt;
&lt;span class="nc"&gt;PROXY&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/cl/&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;https://totaljs.com&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;check&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;ctrl&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="c1"&gt;// Add your custom logic here&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// Return true to proceed with proxying&lt;/span&gt;
    &lt;span class="p"&gt;})&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;before&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;uri&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;ctrl&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`Proxying request: &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;uri&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="c1"&gt;// Modify the request URI or the controller as needed&lt;/span&gt;
    &lt;span class="p"&gt;})&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;after&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;response&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Received response:&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;response&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="c1"&gt;// Manipulate the response before sending it back to the client&lt;/span&gt;
    &lt;span class="p"&gt;});&lt;/span&gt;

&lt;span class="c1"&gt;// Dynamically remove the proxy route if needed&lt;/span&gt;
&lt;span class="c1"&gt;// PROXY('/cl/', 'https://totaljs.com').remove();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Adapting to Use Cases with Copy Modes
&lt;/h3&gt;

&lt;p&gt;Depending on your specific use case, you can choose how the proxy handles query strings:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Example usage of .copy() with different modes&lt;/span&gt;
&lt;span class="nc"&gt;PROXY&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/cl/&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;https://yourdomain.com&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;copy&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;replace&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// Use 'none' or 'extend' as needed&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Understanding the &lt;code&gt;.copy()&lt;/code&gt; method in detail
&lt;/h3&gt;

&lt;p&gt;The &lt;code&gt;.copy()&lt;/code&gt; method in &lt;strong&gt;Total.js&lt;/strong&gt; v5 allows developers to specify how the proxy server handles the original request's query string when forwarding to the target URL. This method supports three distinct modes: &lt;code&gt;none&lt;/code&gt;, &lt;code&gt;replace&lt;/code&gt;, and &lt;code&gt;extend&lt;/code&gt;. Let's explore each mode with detailed examples to illustrate their use cases:&lt;/p&gt;

&lt;h4&gt;
  
  
  1. &lt;code&gt;none&lt;/code&gt;
&lt;/h4&gt;

&lt;p&gt;The &lt;code&gt;none&lt;/code&gt; mode tells the proxy to ignore the original query string entirely. This is useful when you want to proxy the request but don't need to pass any query parameters to the target URL.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nc"&gt;PROXY&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/cl/&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;https://yourdomain.com&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;copy&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;none&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Request&lt;/strong&gt;: &lt;code&gt;GET /cl/?q=search&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Proxied as&lt;/strong&gt;: &lt;code&gt;https://yourdomain.com/&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In this mode, even if the original request contains query parameters (&lt;code&gt;?q=search&lt;/code&gt;), they are not forwarded to the target URL.&lt;/p&gt;

&lt;h4&gt;
  
  
  2. &lt;code&gt;replace&lt;/code&gt;
&lt;/h4&gt;

&lt;p&gt;The &lt;code&gt;replace&lt;/code&gt; mode is used when you want to replace the path of the original request with the proxy path, but without carrying over the query string.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nc"&gt;PROXY&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/cl/&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;https://yourdomain.com&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;copy&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;replace&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Request&lt;/strong&gt;: &lt;code&gt;GET /cl/?q=search&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Proxied as&lt;/strong&gt;: &lt;code&gt;https://yourdomain.com/&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Request&lt;/strong&gt;: &lt;code&gt;GET /cl/something/?q=search&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Proxied as&lt;/strong&gt;: &lt;code&gt;https://yourdomain.com/something/&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In &lt;code&gt;replace&lt;/code&gt; mode, the path after the proxy endpoint (&lt;code&gt;/cl/&lt;/code&gt;) is appended to the target URL. However, the query string from the original request is not included.&lt;/p&gt;

&lt;h4&gt;
  
  
  3. &lt;code&gt;extend&lt;/code&gt;
&lt;/h4&gt;

&lt;p&gt;The &lt;code&gt;extend&lt;/code&gt; mode combines the path and query string from the original request and appends them to the target URL. This is particularly useful for APIs where you need to maintain the integrity of the original request.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nc"&gt;PROXY&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/cl/&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;https://yourdomain.com&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;copy&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;extend&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Request&lt;/strong&gt;: &lt;code&gt;GET /cl/?q=search&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Proxied as&lt;/strong&gt;: &lt;code&gt;https://yourdomain.com/?q=search&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Request&lt;/strong&gt;: &lt;code&gt;GET /cl/something/?q=search&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Proxied as&lt;/strong&gt;: &lt;code&gt;https://yourdomain.com/something/?q=search&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Here, both the path and query parameters of the original request are preserved and appended to the target URL, making it an ideal choice for scenarios where every part of the request is essential for the recipient.&lt;/p&gt;

&lt;h3&gt;
  
  
  Choosing the Right Mode
&lt;/h3&gt;

&lt;p&gt;Selecting the appropriate mode depends on your specific use case:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use &lt;code&gt;none&lt;/code&gt; when the target URL does not require any query parameters from the original request.&lt;/li&gt;
&lt;li&gt;Opt for &lt;code&gt;replace&lt;/code&gt; when you need to maintain the path but not the query parameters.&lt;/li&gt;
&lt;li&gt;Choose &lt;code&gt;extend&lt;/code&gt; when both the path and query parameters are crucial for the target URL to process the request correctly.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Understanding these modes and their applications ensures that you can tailor the proxy behavior to fit your application's needs precisely, enhancing both functionality and user experience.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Total.js v5&lt;/strong&gt; significantly expands the capabilities of its proxy functionality, providing developers with more tools and options to create efficient, flexible, and powerful proxy servers. Whether you're building microservices, handling complex routing, or simply need a proxy for development purposes, &lt;strong&gt;Total.js v5&lt;/strong&gt; offers the features and flexibility needed to get the job done.&lt;/p&gt;

&lt;p&gt;Explore these new features and see how they can enhance your &lt;strong&gt;Total.js&lt;/strong&gt; applications. Happy coding!&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://t.me/totaljs"&gt;Join &lt;strong&gt;Total.js Telegram community&lt;/strong&gt;&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
    </item>
    <item>
      <title>Total.js Platform is here</title>
      <dc:creator>Louis Bertson</dc:creator>
      <pubDate>Wed, 03 Apr 2024 09:56:22 +0000</pubDate>
      <link>https://dev.to/louis_bertson_1124e9cdc59/totaljs-platform-is-here-57ka</link>
      <guid>https://dev.to/louis_bertson_1124e9cdc59/totaljs-platform-is-here-57ka</guid>
      <description>&lt;h1&gt;
  
  
  Effortless Application Development with Total.js Platform
&lt;/h1&gt;

&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://www.totaljs.com"&gt;&lt;strong&gt;Total.js&lt;/strong&gt;&lt;/a&gt; offers a streamlined approach to application development, focusing on minimalism without compromising power. One of its most compelling features is the comprehensive ecosystem it provides, along with minimal dependencies, making it an attractive choice for developers looking to build robust applications with ease.&lt;/p&gt;

&lt;h2&gt;
  
  
  The All-In-One Nature of Total.js
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://www.totaljs.com"&gt;Total.js Platform&lt;/a&gt; simplifies the development process by offering everything developers need within the framework itself. With just a few simple commands (&lt;code&gt;npm i total4&lt;/code&gt; or &lt;code&gt;npm i total5&lt;/code&gt;), you can kickstart your Total.js project without worrying about managing numerous dependencies.&lt;/p&gt;

&lt;h2&gt;
  
  
  Exploring Key Total.js Applications
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Total.js Code Editor
&lt;/h3&gt;

&lt;p&gt;The &lt;a href="https://www.totaljs.com/code"&gt;Total.js Code Editor&lt;/a&gt;  is a server-side development tool tailored for creating web applications within a web browser. It facilitates real-time collaboration and offers a plethora of features, making it an invaluable asset for accelerating development workflows.&lt;br&gt;
&lt;strong&gt;Github&lt;/strong&gt;: &lt;a href="https://github.com/totaljs/code"&gt;totaljs/code&lt;/a&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--K2XD4wwt--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://www.totaljs.com/download/a8ql001ua41d.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--K2XD4wwt--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://www.totaljs.com/download/a8ql001ua41d.jpg" alt="image" width="800" height="573"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Total.js SuperAdmin
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://www.totaljs/superadmin"&gt;SuperAdmin&lt;/a&gt; simplifies Node.js application management on Linux servers. It seamlessly integrates with NGINX for reverse proxying and Let's Encrypt for SSL certificate generation, providing a hassle-free experience for deploying Total.js applications.&lt;br&gt;
&lt;strong&gt;Github&lt;/strong&gt;: &lt;a href="https://github.com/totaljs/superadmin"&gt;totaljs/superadmin&lt;/a&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--VhvZpkn4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://www.totaljs.com/download/am5k001nl41d.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--VhvZpkn4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://www.totaljs.com/download/am5k001nl41d.png" alt="Total.js Superadmin user interface" width="800" height="634"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Total.js CMS
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://www.totaljs.com"&gt;Total.js CMS&lt;/a&gt; offers a clean and intuitive content management solution for websites. Built on a NoSQL embedded database with no external dependencies, it empowers users to manage commercial or personal websites effortlessly.&lt;br&gt;
&lt;strong&gt;Github&lt;/strong&gt;: &lt;a href="https://www.totaljs.com/cms"&gt;totaljs/cms&lt;/a&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--k_S8mzPQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://www.totaljs.com/download/am6l001bn41d.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--k_S8mzPQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://www.totaljs.com/download/am6l001bn41d.png" alt="Total.js cms UI" width="800" height="613"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Total.js Flow
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://www.totaljs.com/flow"&gt;Total.js Flow&lt;/a&gt; is a friendly, modern, and straightforward Visual Programming Interface designed for Low-code Development. Accessible through a web browser, this tool seamlessly integrates, processes, and transforms various events and data in real time.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;GitHub:&lt;/strong&gt; &lt;a href="https://github.com/totaljs/flow"&gt;totaljs/flow&lt;/a&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--L5XTQJhs--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://www.totaljs.com/download/snoo002gi40d.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--L5XTQJhs--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://www.totaljs.com/download/snoo002gi40d.jpg" alt="Flow Image" width="800" height="486"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Total.js UI Builder
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://www.totaljs.com/uibuilder"&gt;Total.js UI Builder&lt;/a&gt; is tailored for creating UI applications across a spectrum of use cases, including classic web applications, dashboards, flowboards, parts, hybrid mobile apps, HMI apps, and more.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;GitHub:&lt;/strong&gt; &lt;a href="https://github.com/totaljs/uistudio"&gt;totaljs/uistudio&lt;/a&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--e32O2pU0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://www.totaljs.com/download/yio7001yf41d.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--e32O2pU0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://www.totaljs.com/download/yio7001yf41d.jpg" alt="UI Builder Image" width="800" height="525"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Integration Tools
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://www.totaljs.com/openauth"&gt;&lt;strong&gt;OpenAuth&lt;/strong&gt;&lt;/a&gt;: Lightweight OAuth 2.0 integrator for obtaining user profiles from various services.&lt;br&gt;
&lt;strong&gt;GitHub:&lt;/strong&gt; &lt;a href="https://github.com/totaljs/openauth"&gt;totaljs/openauth&lt;/a&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--PZpKLZQG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://www.totaljs.com/download/t3pt001ew41d.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--PZpKLZQG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://www.totaljs.com/download/t3pt001ew41d.jpg" alt="Total.js OpenAuth" width="" height=""&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://www.totaljs.com/opensync"&gt;&lt;strong&gt;OpenSync&lt;/strong&gt;&lt;/a&gt;: Synchronization HTTP server for handling external requests and data dissemination.&lt;br&gt;
&lt;strong&gt;GitHub:&lt;/strong&gt; &lt;a href="https://github.com/totaljs/opensync"&gt;totaljs/opensync&lt;/a&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--oVtJPtkk--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://www.totaljs.com/download/t3oy001ew41d.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--oVtJPtkk--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://www.totaljs.com/download/t3oy001ew41d.jpg" alt="UI of total.js Opensync" width="" height=""&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://www.totaljs.com/openmail"&gt;&lt;strong&gt;OpenMail&lt;/strong&gt;&lt;/a&gt;: SMTP sender for creating and managing multiple SMTP profiles with HTML templates.&lt;br&gt;
&lt;strong&gt;GitHub:&lt;/strong&gt; &lt;a href="https://totaljs.com/openmail"&gt;totaljs/openmail&lt;/a&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--OlscvpdE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://www.totaljs.com/download/t3lm001ew41d.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--OlscvpdE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://www.totaljs.com/download/t3lm001ew41d.png" alt="UI of OpenMail" width="" height=""&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="http://www.totaljs.com/openfiles"&gt;&lt;strong&gt;OpenFiles&lt;/strong&gt;&lt;/a&gt;: File storage solution for storing files from 3rd party apps.&lt;br&gt;
&lt;strong&gt;GitHub:&lt;/strong&gt; &lt;a href="https://github.com/openfiles"&gt;totaljs/openfiles&lt;/a&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--CqABB8Qo--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://www.totaljs.com/download/t3kn001gf41d.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--CqABB8Qo--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://www.totaljs.com/download/t3kn001gf41d.png" alt="UI of OpenFiles" width="" height=""&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://www.totaljs.com/openlogger"&gt;&lt;strong&gt;OpenLogger&lt;/strong&gt;&lt;/a&gt;: Lightweight logging solution for storing logs from 3rd party apps.&lt;br&gt;
&lt;strong&gt;GitHub:&lt;/strong&gt; &lt;a href="https://github.com/totaljs/openlogger"&gt;totaljs/openlogger&lt;/a&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--rqKmU5rO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://www.totaljs.com/download/t3lx001ew41d.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--rqKmU5rO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://www.totaljs.com/download/t3lx001ew41d.png" alt="UI of Total.js OpenLogger" width="" height=""&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://www.totaljs.com/opentemplates"&gt;&lt;strong&gt;OpenTemplates&lt;/strong&gt;&lt;/a&gt;: App for creating HTML templates printable as PDF/DOCX/JPG files.&lt;br&gt;
&lt;strong&gt;GitHub:&lt;/strong&gt; &lt;a href="https://github.com/totaljs/opentemplates"&gt;totaljs/opentemplates&lt;/a&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--J1O2-1kT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://www.totaljs.com/download/ze79001cj41d.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--J1O2-1kT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://www.totaljs.com/download/ze79001cj41d.jpg" alt="UI of Total.js Open templates" width="" height=""&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://www.totaljs.com/openreports"&gt;&lt;strong&gt;OpenReports&lt;/strong&gt;&lt;/a&gt;: App for generating simple reports from PostgreSQL databases.&lt;br&gt;
&lt;strong&gt;GitHub:&lt;/strong&gt; &lt;a href="https://github.com/totaljs/openreports"&gt;totaljs/reports&lt;/a&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--OV-wX0Ue--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://www.totaljs.com/download/13glu001yj51d.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--OV-wX0Ue--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://www.totaljs.com/download/13glu001yj51d.jpg" alt="UI of Total.js OpenReports" width="" height=""&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://www.totaljs.com/bannersystem"&gt;&lt;strong&gt;BannerSystem&lt;/strong&gt;&lt;/a&gt;: Open-source banner system for portals and websites.&lt;br&gt;
&lt;strong&gt;GitHub:&lt;/strong&gt; &lt;a href="https://github.com/totaljs/bannersystem"&gt;totaljs/bannersystem&lt;/a&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--lkr9zZub--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://www.totaljs.com/download/12bbn001el51d.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--lkr9zZub--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://www.totaljs.com/download/12bbn001el51d.jpg" alt="UI of Total.js BannerSystem" width="" height=""&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Extensible&lt;/strong&gt;: HTTP server for handling dynamic Total.js extensions.&lt;br&gt;
&lt;strong&gt;GitHub:&lt;/strong&gt; &lt;a href="https://github.com/totaljs/extensions"&gt;totaljs/extensions&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Other Useful Total.js Apps
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Todomator
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://www.totaljs.com/todomator"&gt;Todomator&lt;/a&gt; is a task manager designed for small teams. With features like time tracking, REST API support, and open-source licensing, it offers a robust solution for project management.&lt;br&gt;
&lt;strong&gt;GitHub:&lt;/strong&gt; &lt;a href="https://github.com/totaljs/todomator"&gt;totaljs/todomator&lt;/a&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Q13lyOkX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://www.totaljs.com/download/15iw8001mj51d.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Q13lyOkX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://www.totaljs.com/download/15iw8001mj51d.png" alt="UI of Total.js Todimator" width="" height=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  OpenPlatform
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://www.totaljs.com/openplatform"&gt;OpenPlatform&lt;/a&gt; serves as an enterprise-ready platform for running, integrating, and managing multiple 3rd party web applications. It provides a simple container for users and applications, independent of client-side/server-side technologies.&lt;br&gt;
&lt;strong&gt;GitHub:&lt;/strong&gt; &lt;a href="https://github.com/totaljs/openplatform"&gt;totaljs/openplatform&lt;/a&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--FrflUpI1--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_800/https://docs.totaljs.com/download/xav3001kb41d-1si7hid-640x492-1.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--FrflUpI1--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_800/https://docs.totaljs.com/download/xav3001kb41d-1si7hid-640x492-1.gif" alt="description" width="640" height="492"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Total.js&lt;/strong&gt; stands out as a powerful yet minimalist framework for application development. With its all-in-one nature and comprehensive ecosystem of applications and tools, it streamlines the development process and empowers developers to build robust web applications efficiently. Explore Total.js today and experience effortless application development firsthand.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>The Art of File Routing</title>
      <dc:creator>Louis Bertson</dc:creator>
      <pubDate>Mon, 11 Dec 2023 23:31:44 +0000</pubDate>
      <link>https://dev.to/louis_bertson_1124e9cdc59/the-art-of-file-routing-767</link>
      <guid>https://dev.to/louis_bertson_1124e9cdc59/the-art-of-file-routing-767</guid>
      <description>&lt;p&gt;In the world of web development, efficiently handling custom files like images, documents, and uploads is a challenge that every developer faces. Total.js, a cutting-edge Node.js framework, offers a game-changing solution with its &lt;code&gt;ROUTE(FILE ...)&lt;/code&gt; functionality. In this article, we'll delve into the intricacies of handling custom files in Total.js and highlight its advantages over common approaches used in other popular web frameworks.&lt;/p&gt;

&lt;h2&gt;
  
  
  Embracing the Art of Uploading Files
&lt;/h2&gt;

&lt;p&gt;File uploading is a pivotal aspect of modern web applications, but it can often be a hassle to manage. Total.js streamlines this process using the &lt;code&gt;ROUTE('POST /upload/', myupload, ['upload'], 1024)&lt;/code&gt; method. Let's dissect this method with an illustrative example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// File: /controllers/upload.js&lt;/span&gt;

&lt;span class="nx"&gt;exports&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;install&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nc"&gt;ROUTE&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;POST /upload/&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;myupload&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;upload&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="mi"&gt;1024&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// 1024 kB = max. request size&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;myupload&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nb"&gt;self&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="c1"&gt;// The "self.files" array encapsulates HttpFile objects&lt;/span&gt;
    &lt;span class="c1"&gt;// Each HttpFile object represents an uploaded file&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;files&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

    &lt;span class="c1"&gt;// Implement your custom processing logic here&lt;/span&gt;

    &lt;span class="nb"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;success&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt; &lt;span class="c1"&gt;// Signal successful processing&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this snippet, the &lt;code&gt;myupload&lt;/code&gt; function leaps into action when a &lt;code&gt;POST&lt;/code&gt; request targets the &lt;code&gt;/upload/&lt;/code&gt; route. The &lt;code&gt;'upload'&lt;/code&gt; flag hints that this route handles file uploads, while &lt;code&gt;1024&lt;/code&gt; determines the maximum request size in kilobytes.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Art of File Routing
&lt;/h2&gt;

&lt;p&gt;Total.js reinvents the concept of file routing by optimizing performance and dynamically processing static files. This capability finds its expression through the &lt;code&gt;ROUTE('FILE ...')&lt;/code&gt; syntax.&lt;/p&gt;

&lt;h3&gt;
  
  
  Empowering All Files in a Directory
&lt;/h3&gt;

&lt;p&gt;Total.js unleashes a new paradigm for managing files within specific directories:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;exports&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;install&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nc"&gt;ROUTE&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;FILE /documents/*.*&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;handle_documents&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="nc"&gt;ROUTE&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;FILE /images/*.jpg&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;  &lt;span class="nx"&gt;handle_images&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;handle_documents&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// Your genius in handling document files here&lt;/span&gt;
    &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;file&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/path/to/file.pdf&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// Deliver the requested file&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;handle_images&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// Unleash your magic with image files&lt;/span&gt;
    &lt;span class="c1"&gt;// Modify or process the image as needed&lt;/span&gt;
    &lt;span class="c1"&gt;// Then, use res.file() to serve the customized image&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this excerpt, the &lt;code&gt;handle_documents&lt;/code&gt; and &lt;code&gt;handle_images&lt;/code&gt; functions spring to life when requests for document and image files are sent. The &lt;code&gt;res.file()&lt;/code&gt; method plays the role of delivering the desired files to the awaiting client.&lt;/p&gt;

&lt;h3&gt;
  
  
  Resizing Images: A Total Transformation
&lt;/h3&gt;

&lt;p&gt;Total.js doesn't stop at traditional file handling; it redefines the game with its image resizing prowess. The &lt;code&gt;RESIZE(...)&lt;/code&gt; function is a star player in this spectacle:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;exports&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;install&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nc"&gt;RESIZE&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/gallery/*.jpg&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;resize&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;resize&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;image&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;image&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;resize&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;120&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;120&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// Transform the image to 120x120 pixels&lt;/span&gt;
    &lt;span class="nx"&gt;image&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;quality&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;90&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;      &lt;span class="c1"&gt;// Set image quality at 90%&lt;/span&gt;
    &lt;span class="nx"&gt;image&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;minify&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;         &lt;span class="c1"&gt;// Shrink the image size&lt;/span&gt;
    &lt;span class="c1"&gt;// The modified, sleek image rests in the temporary directory&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this revelation, the &lt;code&gt;resize&lt;/code&gt; function takes the stage when a &lt;code&gt;.jpg&lt;/code&gt; image request dances into the &lt;code&gt;/gallery/&lt;/code&gt; realm. With finesse, it resizes, optimizes quality, and miniaturizes the image. The revamped image then takes its place in the temporary directory, ready for delivery.&lt;/p&gt;

&lt;h2&gt;
  
  
  Unveiling the Revolution
&lt;/h2&gt;

&lt;p&gt;Total.js stands as a titan among web frameworks, delivering an unmatched experience in handling custom files. Its innovative approach redefines how we upload, route, and manipulate files. By exploiting the &lt;code&gt;ROUTE(FILE ...)&lt;/code&gt; and &lt;code&gt;RESIZE(...)&lt;/code&gt; methods, developers are empowered to efficiently process and present diverse files. Total.js isn't just a framework; it's a revolution that takes file handling to a level previously unseen in the web development landscape.&lt;/p&gt;

</description>
      <category>totaljs</category>
      <category>webdev</category>
      <category>node</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Unleashing SuperAdmin: A Total.js Game-Changer for Node.js Process Management</title>
      <dc:creator>Louis Bertson</dc:creator>
      <pubDate>Tue, 05 Dec 2023 10:28:09 +0000</pubDate>
      <link>https://dev.to/louis_bertson_1124e9cdc59/unleashing-superadmin-a-totaljs-game-changer-for-nodejs-process-management-4cmk</link>
      <guid>https://dev.to/louis_bertson_1124e9cdc59/unleashing-superadmin-a-totaljs-game-changer-for-nodejs-process-management-4cmk</guid>
      <description>&lt;p&gt;🚀 Hey dev.to community! Today, we're thrilled to introduce you to SuperAdmin – a powerful Node.js process management tool that's set to revolutionize the way you handle web applications, REST services, and websites built with Total.js.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why SuperAdmin?
&lt;/h2&gt;

&lt;h3&gt;
  
  
  🌐 Total.js Brilliance
&lt;/h3&gt;

&lt;p&gt;SuperAdmin is born out of the Total.js ecosystem, bringing with it the reliability and efficiency that developers have come to love. Its seamless integration with Total.js makes it a go-to solution for managing and monitoring web projects.&lt;/p&gt;

&lt;h3&gt;
  
  
  🛡️ Data Security on Your Servers
&lt;/h3&gt;

&lt;p&gt;Worried about data security? SuperAdmin takes care of that! All your data is stored securely on your servers, putting you in control and ensuring the privacy of your sensitive information.&lt;/p&gt;

&lt;h3&gt;
  
  
  🖥️ User-Friendly Interface and Low Hardware Requirements
&lt;/h3&gt;

&lt;p&gt;No need for a tech wizardry degree to navigate SuperAdmin. The user-friendly interface makes process management a breeze. Plus, it comes with low hardware requirements, ensuring efficiency without breaking the bank.&lt;/p&gt;

&lt;h2&gt;
  
  
  Dive Deeper with SuperAdmin
&lt;/h2&gt;

&lt;p&gt;🎥 &lt;strong&gt;Watch the Introduction Video:&lt;/strong&gt; &lt;br&gt;
&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/O_e-LhuK3js"&gt;
&lt;/iframe&gt;
&lt;br&gt;
🔍 &lt;strong&gt;Explore Features:&lt;/strong&gt; [&lt;a href="https://totaljs.com/superadmin"&gt;https://totaljs.com/superadmin&lt;/a&gt;]&lt;/p&gt;

&lt;h2&gt;
  
  
  How to Get Started
&lt;/h2&gt;

&lt;p&gt;Getting started with SuperAdmin is as easy as 1-2-3! Follow these steps:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Install SuperAdmin using &lt;a href="https://docs.totaljs.com/superadmin/65689001xi51c/"&gt;instructions&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Configure your projects effortlessly with the intuitive UI.&lt;/li&gt;
&lt;li&gt;Watch your Node.js projects soar to new heights!&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Join the SuperAdmin Community
&lt;/h2&gt;

&lt;p&gt;Let's build a vibrant community of SuperAdmin enthusiasts! Share your experiences, ask questions, and connect with fellow developers on &lt;a href="https://t.me/totaljs"&gt;Telegram&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Final Thoughts
&lt;/h2&gt;

&lt;p&gt;SuperAdmin isn't just a tool; it's a game-changer for Node.js developers. Elevate your development workflow, enhance security, and embrace the future of process management.&lt;/p&gt;

&lt;p&gt;Ready to supercharge your projects? &lt;a href="https://youtu.be/O_e-LhuK3js"&gt;Watch the video&lt;/a&gt; and embark on the SuperAdmin journey today!&lt;/p&gt;

&lt;p&gt;🚀 &lt;strong&gt;SuperAdmin: Total.js Power in Your Hands!&lt;/strong&gt;&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
