<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by priya s on Medium]]></title>
        <description><![CDATA[Stories by priya s on Medium]]></description>
        <link>https://medium.com/@priyabecse10?source=rss-7f7ad90f7591------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*hKlrR4djFWtSskrC</url>
            <title>Stories by priya s on Medium</title>
            <link>https://medium.com/@priyabecse10?source=rss-7f7ad90f7591------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 17:56:36 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@priyabecse10/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Introduction to Pub/Sub:]]></title>
            <link>https://medium.com/yavar/introduction-to-pub-sub-787d42250c4f?source=rss-7f7ad90f7591------2</link>
            <guid isPermaLink="false">https://medium.com/p/787d42250c4f</guid>
            <category><![CDATA[pub-sub-pattern]]></category>
            <category><![CDATA[pub-sub]]></category>
            <dc:creator><![CDATA[priya s]]></dc:creator>
            <pubDate>Mon, 20 Mar 2023 15:35:20 GMT</pubDate>
            <atom:updated>2023-03-21T01:44:47.152Z</atom:updated>
            <content:encoded><![CDATA[<p>Hi friends, in this blog we will see about Pub/Sub(Publish/Subscribe) mechanism.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/450/0*2pjoU9OlhVGanYpy.gif" /></figure><p>Pub/Sub is an asynchronous and scalable messaging service that decouples services producing messages from services processing those messages.</p><p>Pub/Sub is used for streaming analytics and data integration pipelines to ingest and distribute data. Basically, the Pub/Sub model involves:</p><ol><li>A publisher who sends a message.</li><li>A subscriber who receives the message via a message broker.</li></ol><p>With the popularity of decoupled and microservice-based applications, proper communication between components and services is crucial for overall application functionality. Pub/Sub messaging helps with this in two crucial ways:</p><ul><li>Allowing developers to create decoupled applications easily with a reliable communication method</li><li>Enabling users to create event-driven architectures easily</li></ul><p>A pub/sub model allows messages to be broadcasted asynchronously across multiple sections of the applications.</p><p>The core component that facilitates this functionality is something called a Topic. The publisher will push messages to a Topic, and the Topic will instantly push the message to all the subscribers. This is what differentiates the Pub/Sub model from traditional message brokers, where a message queue will batch individual messages until a user or service requests these messages and retrieves them.</p><p>Whatever the message is in the Pub/Sub model, it will be automatically pushed to all the subscribers. The only exception is user-created policies for subscribers that will filter out messages.</p><p>This approach makes it possible to create event-driven services without constantly querying a message queue for messages. It also enables developers to create different isolated functions using the same message (data) that can be executed parallelly with the ability to serve multiple subscribers.</p><p>The Pub/Sub pattern isolates publishers from subscribers so that publishers do not need to know where the message is being used while the subscriber does not need to know about the publisher. This helps to improve the overall security of the application organically.</p><p><strong>Advantages of publish/subscribe pattern:</strong></p><ol><li>Decoupled/loosely couples components.</li><li>Greater system-wide visibility</li><li>Real-time communication</li><li>Ease of development</li><li>Increased scalability and reliability</li><li>Test ability improvements</li></ol><p><strong>Disadvantages of pub/sub pattern:</strong></p><ol><li>Pub/Sub should be properly configured and maintained.</li><li>Pub/Sub is suitable when dealing with media such as audio or video as they require smooth synchronous streaming between the host and the receiver.</li></ol><p><strong>Common use cases:</strong></p><ol><li>Ingestion user interaction and server events.</li><li>Real-time event distribution</li><li>Replicating data among databases.</li><li>Parallel processing and workflows</li><li>Enterprise event bus.</li><li>Data streaming from applications, services or IoT devices.</li><li>Refreshing distributed caches</li><li>Load balancing for reliability.</li></ol><p><strong>Pub/Sub messaging services:</strong></p><ol><li>Apache Kafka- Developed by Apache, kafka has robust Pub/Sub messaging features with message logs.</li><li>Faye- Simple Pub/Sub service designed to power web applications with servers designed for NodeJS and Ruby.</li><li>Redis- This is one of the most popular message broers with support for both traditional message queues as well as pub/sub pattern implementations.</li><li>Amazon SNS — The Amazon Simple Notification Service is a fully managed service that offers Pub/Sub messages.</li><li>Google Pub/Sub — GCP offering for pub/sub messaging service implementation.</li><li>Azure Service Bus — A robust messaging service (Maas) solution that offers Pub/Sub pattern.</li></ol><p>Hope you find it useful! Thanks for reading!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=787d42250c4f" width="1" height="1" alt=""><hr><p><a href="https://medium.com/yavar/introduction-to-pub-sub-787d42250c4f">Introduction to Pub/Sub:</a> was originally published in <a href="https://medium.com/yavar">YavarTechWorks</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why to choose NestJS?]]></title>
            <link>https://medium.com/yavar/why-to-choose-nestjs-42142e5a7286?source=rss-7f7ad90f7591------2</link>
            <guid isPermaLink="false">https://medium.com/p/42142e5a7286</guid>
            <category><![CDATA[nestjs]]></category>
            <dc:creator><![CDATA[priya s]]></dc:creator>
            <pubDate>Mon, 20 Mar 2023 10:09:56 GMT</pubDate>
            <atom:updated>2023-03-21T01:44:52.951Z</atom:updated>
            <content:encoded><![CDATA[<p>Hi friends, in this blog we will see about why we need NestJS.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/0*kUYhd4xEZ-SA81uZ" /></figure><p>NestJS is a simple framework used to build a scalable and efficient NodeJs server-side application with full support for TypeScript. NestJS uses robust HTTP Server frameworks like Fastify or Express.</p><p><strong>What is NestJS?</strong></p><p>NestJs is an extensible, versatile, progressive framework used to create a demanding and compelling fastes-growing NodeJs framework. It is used to write scalable and loosely coupled applications. It also supports databases like MySQL, MongoDB and PostgreSQL. Nestjs is influenced by React, Angular and Vue.</p><p><strong>Folder Structure for Nestjs:</strong></p><p>Providers, Controllers and Modules are the building blocks of the NestJS.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/363/1*SUhJ0Sg7SeES0ms7kgixTQ.png" /></figure><p>app.controller.ts — → It is the basic controller with a single route.</p><p>app.module.ts — → The root module of the application.</p><p>app.service.ts — → A basic service with a single method.</p><p>app.controller.spec.ts — -&gt; the unit tests for the controller.</p><p>main.ts — → The entry file of the application which uses the core function NestFactory to create a Nest application instance.</p><p><strong>Controllers:</strong></p><p>The controllers are responsible for handling incoming requests and returning responses to the client. The routing mechanism controls which controller receives which requests. Controllers are denoted with the @Controller() decorator.</p><p><strong>Providers:</strong></p><p>Providers are the plain javascript classes that are declared as providers in a module. The logics behind the incoming request will be handled here and returned back to the controller. Providers are denoted with the @Injectable() decorator since it can be injected as a dependency in the application.</p><p><strong>Modules:</strong></p><p>The module is the class annotated with a @Module() decorator. This provides the metadata that Nest makes use of to organise the application structure.</p><p><strong>Significant features of NestJS:</strong></p><ol><li>Easy to learn, master and use.</li></ol><p>2. Active codebase maintenance and development.</p><p>3. Easy unit-testing applications.</p><p>4. Open-source MIT license.</p><p>5. Powerful command-line interface used to boost productivity for easy development.</p><p>Nest JS is a superset of JavaScript with leveraged typescript. It also supports dozens of specific modules that easily integrate with different technologies and concepts like Mongoose, Logging, Caching, Validation, and Type ORM.</p><p><strong>Why should you choose Nest JS?</strong></p><p>JavaScript is a programming language that is older than 20 years. It is the main framework that helps to create business applications and focuses on shifting towards node JS.</p><p>Nest JS is the fast-growing framework for Node JS. The following are the reasons to choose NEST JS:</p><ul><li>Efficient and quick response in the development process</li><li>Easy in maintaining applications and highly scalable.</li><li>Fastest growing framework for the past 3 years</li><li>Large community and support.</li><li>Great documentation</li><li>Easy in unit testing</li><li>Nest JS provides you to build microservices, and create high testable, easily maintainable applications.</li><li>The structure of the application in the nest is based on angular. However, the structure is simple and allows us to pay attention to consumers and the design of endpoints instead of focusing on application structure.</li><li>Nest JS forces the developers in using a specific architecture by introducing controllers’ services, angular-like modules, loosely coupled contrary, and highly testable.</li></ul><p>Hope you find it useful! Thank you for reading.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=42142e5a7286" width="1" height="1" alt=""><hr><p><a href="https://medium.com/yavar/why-to-choose-nestjs-42142e5a7286">Why to choose NestJS?</a> was originally published in <a href="https://medium.com/yavar">YavarTechWorks</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[NestJS — Queue Management]]></title>
            <link>https://medium.com/yavar/nestjs-queue-management-ff08a4a81a40?source=rss-7f7ad90f7591------2</link>
            <guid isPermaLink="false">https://medium.com/p/ff08a4a81a40</guid>
            <category><![CDATA[nestjs-queues]]></category>
            <category><![CDATA[bull-queues]]></category>
            <category><![CDATA[bulls]]></category>
            <dc:creator><![CDATA[priya s]]></dc:creator>
            <pubDate>Mon, 27 Feb 2023 04:52:09 GMT</pubDate>
            <atom:updated>2023-03-01T02:48:22.519Z</atom:updated>
            <content:encoded><![CDATA[<h3>NestJS — Queue Management</h3><p>Hi friends, in this blog we are going to learn about how to implement queues in nestjs using bull package.</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/0*xRW7vUSa72FpLa16" /></figure><p><strong>Queues</strong></p><p>Queues are a powerful design pattern that help you deal with common application scaling and performance challenges. It helps to solve:</p><ol><li>Smooth out processing peaks</li><li>Breaks up a larger task that blocks the Node.js event loop.</li><li>Provide a reliable communication channel across various services.</li></ol><p>Nest provides @nestjs/bull library to implement queues. This package is an integration of Bull queues in Nest environment.</p><p>Bull uses Redis by default. Because, on using Redis, queue architecture can be completely distributed and platform-independent. For eg: if some queue producers, consumers and listeners run on one node and other queue producers, consumers and listeners run on other nodes.</p><p><strong>@nestjs/bull:</strong></p><p>It is a dual mechanism, which consists of producers and consumers.</p><p><strong>Producers:</strong> it pushes some work into the Queue.</p><p><strong>Consumers</strong>: It receives the data from the queue.</p><p>In case of CPU bound operation within an application, if it is handled synchronously there will be problems like requests will take more time when the operations are involved in the CPU. so the user’s thread will be blocked for a while to process the entire operation. Sometimes the response may result in a timeout.</p><p>To avoid this, Nestjs provides a Queueing mechanism. Here long time taking operations will be done later without synchronizing with the user request. In such cases the request will be fast and response will be quick.</p><p><strong>Installation:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/590/0*SXZrN-ZSDIrvA-U0" /></figure><p>Once the installation is done, the BullModule can be imported into the root AppModule.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/590/0*4GFX9u43LAVd7FjW" /></figure><p>The forRoot() method is used to register a bull package configuration object that will be used by all queues registered in the application.</p><p>To register a queue, BullModule.registerQueue() is used.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/256/0*8ij7VKzX6cncKSQF" /></figure><p>In the above picture message-queue and file-operation are the names of two different queues.</p><p><strong>Producers:</strong></p><p>Producers add jobs to queues. They are the normal injectable services.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/630/0*9m1GFnVuX40zrI5I" /></figure><p>The queue name has to be injected in to producer using the @InjectQueue() decorator. To add a queue into the producer we use this.queue.add().</p><p>‘Message-job’ is the job name in the queue, and { name: msg} is the payload.</p><p>The above job will be processed after a 10 seconds delay.</p><p>There can be many job options like:</p><ol><li>Priority:number</li><li>Delay:number</li><li>Attempts:number</li><li>repeat:RepeatOpts</li><li>Lifo:boolean</li><li>Timeout:number</li></ol><p><strong>Consumers:</strong></p><p>Consumers are the normal classes which process the jobs added into the queue or listen for events on the queue or it does both.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/446/0*9WSxm3-NJV2p2Y5u" /></figure><p>Consumer class is declared using @Processor() decorator. The @Processor() decorator is used to specify a queue name. The @Process() decorator is used to specify a job name.</p><p><strong>Event listeners:</strong></p><p>Bull generates a set of useful events when queue and/or job state changes occur.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/571/0*shc5XeT1JwSYf2be" /></figure><p>A local event is one that is produced when an action or state change is triggered on a queue in the local process. When a queue is shared across multiple processes, we encounter the possibility of global events.</p><p>Queue Management:</p><p><strong>await this.queue.add(); </strong>— -&gt; this method is used to add a queue into a producer</p><p><strong>await this.queue.pause(); </strong>— — → the pause queue will not process new jobs until resumed, but current jobs being processed will continue until they are finalized.</p><p><strong>await this.queue.resume(); </strong>— — -&gt; to resume a paused queue, the resume() method is used.</p><p><strong>Async configuration:</strong></p><p>Instead of static, the bull options can be passed asynchronously like</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/286/0*UnWfAtfGiUEvHM3X" /></figure><p>The usefactory syntax allows to create providers dynamically. The factory function can accept arguments and inject property accepts an array of providers that Nest will resolve and pass as arguments to the factory function during the installation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/463/0*zRX5GBlLIt2ZXhAW" /></figure><p>Note: The producers and the consumers should be registered under Providers in AppModule.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/262/0*diqgVZWwfa_sWYJL" /></figure><p>Note: The routing for the producers and consumers should be handled by controllers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/497/0*5EpmFuWzNrngCBCZ" /></figure><p>Hope You find it usefull. Thank you!!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ff08a4a81a40" width="1" height="1" alt=""><hr><p><a href="https://medium.com/yavar/nestjs-queue-management-ff08a4a81a40">NestJS — Queue Management</a> was originally published in <a href="https://medium.com/yavar">YavarTechWorks</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ORM — Types Of ORMs]]></title>
            <link>https://medium.com/yavar/orm-types-of-orms-f8c670b4f7e6?source=rss-7f7ad90f7591------2</link>
            <guid isPermaLink="false">https://medium.com/p/f8c670b4f7e6</guid>
            <category><![CDATA[prisma]]></category>
            <category><![CDATA[orm-tools]]></category>
            <category><![CDATA[orm]]></category>
            <category><![CDATA[sequelize]]></category>
            <category><![CDATA[typeorm]]></category>
            <dc:creator><![CDATA[priya s]]></dc:creator>
            <pubDate>Mon, 23 Jan 2023 12:15:29 GMT</pubDate>
            <atom:updated>2023-01-24T04:20:53.189Z</atom:updated>
            <content:encoded><![CDATA[<h3>ORM — Types Of ORMs</h3><p>Hi everyone, in this blog we will see about the types of ORMs</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*FkPq7uuGIofXk9OuPt9w7Q.png" /></figure><p>Object Relational Mapping (ORM) is a technique used in creating a bridge between object-oriented programs and the relational databases.</p><p><strong>Popular ORM tools for Nodejs:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*ZoAhOIKXl7BDvh1w.jpeg" /></figure><ol><li><strong>Prisma </strong>— <a href="https://www.prisma.io/">Prisma</a> is the next generation Node.js and TypeScript ORm. It supports intuitive data model, automated migrations, type-safety and auto-completion. It supports PostgreSQL, MySQL, SQLite, SQl Server, MongoDB, CockroachDB.</li><li><strong>Sequelize</strong> —<a href="https://sequelize.org/"> Sequelize</a> is a modern Typescript and Node.js ORM for Oracle, PostgreSQL, MySQL, MariaDB, SQLite and SQL server. It supports relations, eager and lazy loading and many more.</li><li><strong>TypeORM </strong>— <a href="https://typeorm.io/">TypeORM</a> can run in Nodejs, ReactNative, NativeScript, Expo and can be used with TypeScript and Javascript. This ORM can be used to develop any kind of application that uss databases — from small application with a few tables to large scale enterprise applications with multiple databases.</li><li><strong>Mongoose </strong>— <a href="https://mongoosejs.com/">Mongoose</a> is a Node.js based Object Data Modelling (ODM) library for MongoDB.</li><li><strong>Bookshelf.js</strong> — <a href="https://bookshelfjs.org/">Bookshelf.js </a>is a JavaScript ORM for Node.js, built on the Knex SQL query builder. It features both Promise-based and traditional callback interfaces, transaction support, eager/nested-eager relation loading, polymorphi associations and support for one-to-one, one-to-many, and many-to-many relations.</li></ol><p><strong>Popular ORM tools for Java:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/490/0*3akWXjYZjG-80Tu9.png" /></figure><ol><li><strong>Hibernate</strong> —<a href="https://hibernate.org/orm/"> Hiberanate</a> enables developers to write data persistent classes following OOP concepts like inheritance, polymorphism, association, composition. Hibernate is highly performant and is also scalable.</li><li><strong>Apache OpenJPA</strong> — <a href="https://openjpa.apache.org/">Apache OpenJPA</a> is also a Java persistance tool. It can be used as a stand-alone <strong>POJO</strong>(plain old Java object) persistence layer.</li><li><strong>EclipseLink</strong> —<a href="https://www.eclipse.org/eclipselink/"> EclipseLink</a> is an open source Java persistence solution for relational, XML and database web services.</li><li><strong>jOOQ </strong>— <a href="https://www.jooq.org/">jOOQ</a> generates Java code from data stored in a database. You can also use this tool to build type safe SQL queries.</li><li><strong>Oracle TopLink</strong> — <a href="https://docs.oracle.com/cd/E17904_01/web.1111/b32441/undtl.htm#JITDG91121">Oracle TopLink</a> tool is used to build high-performace application that store persistent data. The data can be transformed into either relational data or XML elements.</li></ol><p><strong>Popular ORM tools for Python:</strong></p><ol><li><strong>Django</strong> —<a href="https://docs.djangoproject.com/en/4.1/topics/db/queries/"> Django </a>is a great tool for building web applications rapidly</li><li><strong>web2py</strong> —<a href="http://www.web2py.com/init/default/index"> web2py </a>is an open source full-stack Python framework for building fast, scalable, secure and data-driven web applications.</li><li><strong>SQLObject </strong>— <a href="http://www.sqlobject.org/">SQLObject</a> is an object relational manager that provides an object interface to your database.</li><li><strong>SQLAlchemy</strong> — <a href="https://www.sqlalchemy.org/">SQLAlchemy</a> provides persistence patterns designed for efficient and high-performing database access.</li></ol><p><strong>Popular ORM tools for PHP:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*jakdRzd6wjTJnyks.png" /></figure><ol><li><strong>Laravel </strong>— <a href="https://laravel.com/docs/9.x/eloquent">Laravel</a> comes with an object relational manager called Eloquent which makes interaction with databases easier.</li><li><strong>CakePHP</strong> — <a href="https://book.cakephp.org/4/en/orm.html">CakePHP</a> provides two object types: repositories which give you access to a collection of data and entities which represents individual records of data.</li><li><strong>Qcodo </strong>—<a href="https://github.com/qcodo/qcodo"> Qcodo</a> provides different commands that can be run in the terminal to interact with databases.</li><li><strong>RedBeanPHP </strong>— <a href="https://redbeanphp.com/index.php">RedBeanPHP</a> is a zero config object relational mapper.</li></ol><p><strong>Popular ORM tools for .NET:</strong></p><ol><li><strong>Entity Framework</strong> —<a href="https://learn.microsoft.com/en-us/ef/"> Entity Framework</a> is a multi-database object-database mapper. It supports SQL, SQLite, MySQL, PostgreSQL, and Azure Cosmos DB.</li><li><strong>NHibernate </strong>—<a href="https://nhibernate.info/"> NHibernate </a>is an open source object relational mapper with tons of plugins and tools to make development easier and faster</li><li><strong>Dapper </strong>—<a href="https://www.learndapper.com/"> Dapper</a> is a micro-ORM. It is mainly used to map queries to objects. This tool doesn’t do most of the things an ORM tool would do like SQL generation, caching results, lazy loading, and so on.</li><li><strong>Base one Foundation Component Libary </strong>— <a href="http://www.boic.com/b1mspecsheet.htm">BFC</a> is a framework for creating networked database applications with Visual Studio and DBMS software from Microsoft, Oracle, IBM, Sybase, and MySQL.</li></ol><p>Hope You find it useful! Thank you!!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f8c670b4f7e6" width="1" height="1" alt=""><hr><p><a href="https://medium.com/yavar/orm-types-of-orms-f8c670b4f7e6">ORM — Types Of ORMs</a> was originally published in <a href="https://medium.com/yavar">YavarTechWorks</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ORM -Object Relational Mapping]]></title>
            <link>https://medium.com/yavar/orm-object-relational-mapping-6cd05445aa5b?source=rss-7f7ad90f7591------2</link>
            <guid isPermaLink="false">https://medium.com/p/6cd05445aa5b</guid>
            <category><![CDATA[object-relational-mapping]]></category>
            <category><![CDATA[orm]]></category>
            <dc:creator><![CDATA[priya s]]></dc:creator>
            <pubDate>Mon, 23 Jan 2023 12:14:15 GMT</pubDate>
            <atom:updated>2023-01-24T02:32:17.502Z</atom:updated>
            <content:encoded><![CDATA[<p>Hi everyone, In this blog we are going to see about what is an ORM.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/758/1*FkPq7uuGIofXk9OuPt9w7Q.png" /></figure><p>Object Relational Mapping (ORM) is a technique used in creating a bridge between object-oriented programs and the relational databases.</p><p>Wile interacting with a database using OOP languages, we will have to perform different operations like create, read, update and delete(CRUD) data from a database. To do this we will SQL queries to communicate with the database.</p><p>For example,</p><p>If we have retrieve a user with the id=34 from the USERS table, then the SQL query for that record would be</p><p><strong><em>“SELECT * FROM USERS WHERE ID=34”</em></strong></p><p>The above record is retrieved using the WHERE clause in the SQL query.</p><p>The same can be written using the ORM as</p><p><strong><em>users.GetByID(34)</em></strong></p><p><strong>ORM vs SQL:</strong></p><p>Web developers use object relational mappers or ORMs to create an abstract layer without modifying the object-oriented paradigm, which reduces the burden of adapting to a storage format’s database specifications.</p><ol><li>Hands-On Management: When it comes to hands-on management, SQL is higher than ORM. It is important to know how to use SQL in order to maximise the benefits and performance of the database.SQL optimisation can be done by learning the various SQL statements like INSERT, CREATE, SELECT, and so on.</li><li>Level of Abstraction: The level of abstraction refers to the system’s complexity when it is programmed or viewed. The higher the abstraction level is, the less detail the databse contains. The level of abstraction is higher in ORM as compared to SQL. It is one of the key principles of ORM along with inheritance and encapsulation.</li><li>Level of Complexity: ORM is more complex than SQL because it has high level of abstraction and less hands-on management.</li></ol><p>Advantages of using ORM:</p><ol><li>Speeds-up Development — eliminates the need for repetitve SQLcode.</li><li>Reduces Development Time.</li><li>Reduces Development costs</li></ol><p>Disadvantages of Using ORM:</p><ol><li>ORM fails to compete against complex SQL queries.</li><li>ORM has a tendency to be slow.</li></ol><p>Hope You find it Useful!! Thank You!!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6cd05445aa5b" width="1" height="1" alt=""><hr><p><a href="https://medium.com/yavar/orm-object-relational-mapping-6cd05445aa5b">ORM -Object Relational Mapping</a> was originally published in <a href="https://medium.com/yavar">YavarTechWorks</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[PostgreSQL- Like Clause]]></title>
            <link>https://medium.com/yavar/postgresql-like-clause-ee426865639f?source=rss-7f7ad90f7591------2</link>
            <guid isPermaLink="false">https://medium.com/p/ee426865639f</guid>
            <category><![CDATA[pattern-matching]]></category>
            <category><![CDATA[sql]]></category>
            <category><![CDATA[postgres]]></category>
            <dc:creator><![CDATA[priya s]]></dc:creator>
            <pubDate>Sat, 31 Dec 2022 17:07:49 GMT</pubDate>
            <atom:updated>2023-01-02T05:09:19.061Z</atom:updated>
            <content:encoded><![CDATA[<p>Hi everyone, In this blog we are going to see about Like clause in PostgreSQL.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/776/1*6MQ7v8lmMKniXy7MLuw8oA.png" /></figure><p>The PostgreSQL LIKE operator is used to match text values against a pattern. There are two wildcards used along with LIKE operator namely,</p><ol><li>The percent sign (%),</li><li>The Underscore(_)</li></ol><p>The % sign represents zero, one or multiple numbers or characters. The underscore represents a single number or character.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/366/1*CkaMC2okidQP_uWpoXV9Lw.png" /></figure><p>Let us consider the above table which has 5 records of id, name, age, address and salary.</p><p>Example:1</p><p>Syntax: SELECT * FROM TABLE_NAME WHERE COLUMN LIKE ‘XXX%’</p><p>DESCRIPTION: It will find any values that starts with XXX.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/582/1*T2f41MICLdA_omkkCddVag.png" /></figure><p>Note: In PostgreSQL LIKE is compares string only. Hence casting the integer column to string is necessary.</p><p>Example 2:</p><p>Syntax: SELECT * FROM TABLE_NAME WHERE COLUMN LIKE ‘%XXX%’;</p><p>DESCRIPTION : It will find any values that have XXX in any position.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/586/1*dxMjQV5eP8DsU05MO5UDHg.png" /></figure><p>Example 3:</p><p>Syntax: SELECT * FROM TABLE_NAME WHERE COLUMN ILIKE ‘%XXX%’;</p><p>DESCRIPTION : It will find any values that have XXX in any position where ILIKE means it will retrieve all the records irrespective of their cases.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/586/1*47GglTOw7awq0jmNUi55oA.png" /></figure><p>Example 4:</p><p>Syntax: SELECT * FROM TABLE_NAME WHERE COLUMN LIKE ‘_XX’;</p><p>DESCRIPTION : It will find the values that exactly matches XX in the second and third position.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/625/1*LZsQVHEYFN3-VbE9V_tH_Q.png" /></figure><p>Example 5:</p><p>Syntax: SELECT * FROM TABLE_NAME WHERE COLUMN LIKE ‘_XX%’;</p><p>DESCRIPTION : It will find any values that have XX in the second and the third position.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/625/1*hHrvk_cAr08anPkMTNGCmA.png" /></figure><p>Hope you found it useful!!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ee426865639f" width="1" height="1" alt=""><hr><p><a href="https://medium.com/yavar/postgresql-like-clause-ee426865639f">PostgreSQL- Like Clause</a> was originally published in <a href="https://medium.com/yavar">YavarTechWorks</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[PostgreSQL— Constraints]]></title>
            <link>https://medium.com/yavar/postgresql-constraints-19444491e49d?source=rss-7f7ad90f7591------2</link>
            <guid isPermaLink="false">https://medium.com/p/19444491e49d</guid>
            <category><![CDATA[foreign-key]]></category>
            <category><![CDATA[postgres-constraints]]></category>
            <category><![CDATA[unique]]></category>
            <category><![CDATA[primary-key-sql]]></category>
            <category><![CDATA[postgresql]]></category>
            <dc:creator><![CDATA[priya s]]></dc:creator>
            <pubDate>Mon, 19 Dec 2022 14:19:08 GMT</pubDate>
            <atom:updated>2022-12-20T05:51:17.395Z</atom:updated>
            <content:encoded><![CDATA[<p>Hi everyone, in this blog, we will learn about the constraints in PostgreSQL.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/544/0*hsmb8tcGgCu9b565.png" /></figure><p>Constraints are the rules enforced on data columns on table. These are used to prevent invalid data from being entered into the database.</p><p>Constraints could be column level or table level. Column level constraints are applied only to one column whereas table level constraints are applied to the whole table.</p><p>Here are the commonly used constraints available in PostgreSQL.</p><ol><li><strong>NOT NULL</strong> Constraint — Ensures that a column cannot have NULL value.</li><li><strong>UNIQUE </strong>constraint — Ensures that all values in a column are different.</li><li><strong>PRIMARY</strong> key — Uniquely identifies each row/record in a database table.</li><li><strong>FOREIGN</strong> key — Constrains data based on columns in other tables.</li><li><strong>CHECK </strong>Constraint — The CHECK constraint ensures that all values in a column satisfy certain conditions.</li></ol><p><strong>NOT NULL</strong> <strong>Constraint:</strong></p><p>By default, a column can hold NULL values. If you do not want a column to have a NULL value, then you need to define such constraint on this column specifying that NULL value is not allowed for that column.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/723/1*g20JVc4m_igJiusQZDIUbQ.png" /></figure><p>In the above example, the column names namely ID, NAME, AGE has the constraint NOT NULL which means the values in the column cannot be null.</p><p><strong>UNIQUE</strong> <strong>Constraint:</strong></p><p>The UNIQUE Constraint prevents two records from having identical values in a particular column.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/761/1*7pLjqGeX6NPy5suAh9enUQ.png" /></figure><p>In the above example no two people can have same email id. So that column is set as Unique.</p><p><strong>PRIMARY Key Constraint:</strong></p><p>The Primary Key Constraint uniquely identifies each record in a database table. There can be more UNIQUE columns, but only one Primary key in a table. These Primary key are important when designing the database tables. Primary keys are unique ids.</p><p>A table can have only one primary key, which may consist of single or multiple fields. When multiple fields are used as a primary key, they are called a composite key.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/761/1*mVweJQDx0QR-VLjr403ZwQ.png" /></figure><p>In the above table the ID column is set as Primary key, usually the ID will be unique so it is always easy to identify the particular record.</p><p><strong>FOREIGN KEY Constraint</strong>:</p><p>A foreign key constraint specifies that the values in a column (or a group of columns) must match the values appearing in some row of another table. They are called foreign keys because the constraints are foreign; that is, outside the table. Foreign keys are sometimes called a referencing key.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/761/1*mVweJQDx0QR-VLjr403ZwQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/761/1*VTiUYVkSq7Xl0AUrmCD4hg.png" /></figure><p>In the above example, there are two tables namely COMPANY1 and the DEPARTMENT. The ID from the COMPANY1 table is used as the FOREIGN key in the DEPARTMENT table.</p><p><strong>CHECK Constraint:</strong></p><p>The CHECK Constraint enables a condition to check the value being entered into a record. If the condition evaluates to false, the record violates the constraint and is not entered into the table.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/775/1*hHahR-4MmWTSTFR65-DchQ.png" /></figure><p>In the above example, when the query is executed it will create a new table and will check for the SALARY column, if the value is greater than 0, then that particular row is entered into the table.</p><p>Hope you found it useful. Happy learning!!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=19444491e49d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/yavar/postgresql-constraints-19444491e49d">PostgreSQL— Constraints</a> was originally published in <a href="https://medium.com/yavar">YavarTechWorks</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[PostgreSQL — Joins]]></title>
            <link>https://medium.com/yavar/postgresql-joins-5d3a8471df29?source=rss-7f7ad90f7591------2</link>
            <guid isPermaLink="false">https://medium.com/p/5d3a8471df29</guid>
            <category><![CDATA[sql-joins]]></category>
            <category><![CDATA[outer-join]]></category>
            <category><![CDATA[postgresql]]></category>
            <category><![CDATA[full-outer-join]]></category>
            <category><![CDATA[innerjoin]]></category>
            <dc:creator><![CDATA[priya s]]></dc:creator>
            <pubDate>Tue, 29 Nov 2022 16:11:26 GMT</pubDate>
            <atom:updated>2022-11-30T04:48:51.153Z</atom:updated>
            <content:encoded><![CDATA[<h3>PostgreSQL — Joins</h3><p>Hi everyone, in this blog, we will learn about the joins and their types in PostgreSQL.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/526/0*VsNsFuBZQJNZY3Kt.png" /></figure><p>The PostgreSQL joins clause is used to combine records from two or more tables in a database. The types of PostgreSQL follows:</p><ol><li>The cross join</li><li>The inner join</li><li>The left outer join</li><li>The right outer join</li><li>The full outer join</li></ol><p>Let us consider the two tables for performing the joins.</p><p><strong>Company table</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/770/1*QWR7GAUJsqpbZD087E93ww.png" /></figure><p><strong>Department table</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/414/1*Zhzf722PFhCnnc3lXAchQg.png" /></figure><p><strong>THE CROSS JOIN:</strong></p><p>The PostgreSQL Cross Join is used to combine all possibilities of the multiple tables and return the output, which contains each row from all the selected tables. It is also known as the cartesian join that allows to produce the cartesian product of all related tables.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/537/0*LF3SnLK6zahpoOCG.png" /></figure><p>Syntax:</p><p>SELECT …. FROM TABLE1 CROSS JOIN TABLE2</p><p>Example:</p><p>If we perform a cross-join between the company table and department table, it will produce all possible combinations like:</p><p><strong>Query:</strong></p><p><strong>SELECT EMP_ID, NAME, DEPT FROM COMPANY CROSS JOIN DEPARTMENT;</strong></p><p>It will produce the following result.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/570/1*amxZT6QlYpTC5EJXEjyhPQ.png" /></figure><p><strong>THE INNER JOIN:</strong></p><p>In PostgreSQL, the INNER JOIN keyword selects all rows from both tables as long as the condition is satisfied. This keyword will create the result-set by combining all rows from both the tables where the condition satisfies i.e value of the common field will be the same.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/677/0*nZ7i9jhsSk5Wl8ad.png" /></figure><p>Syntax:</p><p>SELECT columns FROM table1 INNER JOIN table2 ON table1.column=table2.column;</p><p><strong>Query:</strong></p><p><strong>SELECT EMP_ID, NAME, DEPT FROM COMPANY INNER JOIN DEPARTMENT ON COMPANY.ID=DEPARTMENT.EMP_ID;</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/507/1*zaf0XmIRgudKT_IF-sSAwA.png" /></figure><p><strong>THE LEFT OUTER JOIN</strong>:</p><p>The PostgreSQL LEFT JOIN or Left Outer Join is used to return all rows from the left table and rows from the other table where the join condition is fulfilled defined in the ON condition. If there is no corresponding records found from the right table, it will return null.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/378/0*SgjhVEZ8F682jaL1.png" /></figure><p><strong>Syntax:</strong></p><p>SELECT … FROM table1 LEFT OUTER JOIN table2 ON conditional_expression …</p><p><strong>Query:</strong></p><p><strong>SELECT EMP_ID, NAME, DEPT FROM COMPANY LEFT OUTER JOIN DEPARTMENT ON COMPANY.ID=DEPARTMENT.EMP_ID;</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/505/1*f_gF8sQ_5y_DG1v6-XAtpg.png" /></figure><p><strong>THE RIGHT OUTER JOIN:</strong></p><p>The PostgreSQL RIGHT JOIN or Right Outer Join is used to return all rows from the right table and rows from the other table where the join condition is fulfilled defined in the ON condition. If there is no corresponding records found from the left table, it will return null.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/396/0*io6mO47NyANUshDz.png" /></figure><p><strong>Syntax:</strong></p><p>SELECT … FROM table RIGHT OUTER JOIN table2 ON conditional_expression</p><p><strong>Query:</strong></p><p><strong>SELECT EMP_ID, NAME, DEPT FROM COMPANY RIGHT OUTER JOIN DEPARTMENT ON COMPANY.ID=DEPARTMENT.EMP_ID;</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/496/1*cvT97vso83SICyxlINaCEg.png" /></figure><p><strong>THE FULL OUTER JOIN:</strong></p><p>First, an inner join is performed. Then, for each row in table T1 that does not satisfy the join condition with any row in table T2, a joined row is added with null values in columns of T2. In addition, for each row of T2 that does not satisfy the join condition with any row in T1, a joined row with null values in the columns of T1 is added.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/370/0*jjk2myz72MpTcC_O.png" /></figure><p><strong>Syntax:</strong></p><p>SELECT … FROM table1 FULL OUTER JOIN table2 ON conditional_expression</p><p><strong>Query:</strong></p><p><strong>SELECT EMP_ID, NAME, DEPT FROM COMPANY FULL OUTER JOIN DEPARTMENT ON COMPANY.ID=DEPARTMENT.EMP_ID;</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/507/1*iGYRLnC9u8Gem-wuuJ5jzA.png" /></figure><p>Hope you found this blog useful. Thank You!!!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5d3a8471df29" width="1" height="1" alt=""><hr><p><a href="https://medium.com/yavar/postgresql-joins-5d3a8471df29">PostgreSQL — Joins</a> was originally published in <a href="https://medium.com/yavar">YavarTechWorks</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Database relationships]]></title>
            <link>https://medium.com/yavar/database-relationships-7bbc653870da?source=rss-7f7ad90f7591------2</link>
            <guid isPermaLink="false">https://medium.com/p/7bbc653870da</guid>
            <category><![CDATA[many-to-many-relationship]]></category>
            <category><![CDATA[relationships]]></category>
            <category><![CDATA[one-to-one]]></category>
            <category><![CDATA[database-relationships]]></category>
            <category><![CDATA[one-to-many]]></category>
            <dc:creator><![CDATA[priya s]]></dc:creator>
            <pubDate>Wed, 16 Nov 2022 08:36:16 GMT</pubDate>
            <atom:updated>2022-11-16T10:51:54.761Z</atom:updated>
            <content:encoded><![CDATA[<p>Hi everyone, in this post, we are going to learn about the different types of relations in databases.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/876/1*OEDDkx6gyQWlclqLbhCE-Q.gif" /></figure><p>Database relationships are associated between tables.</p><p>There are three types of associations namely:</p><ol><li>one-to-one relationship</li><li>one-to-many or many-to-one relationship</li><li>many-to-many relationship</li></ol><p>Below is the diagram to show the notations for the relations used in ER diagram.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/318/0*IPP08ctSq3A_qgXh" /></figure><p><strong>One to one Relationship (1:1):</strong></p><p>It is used to create a relationship between two tables in which a single row of the first table can only be related to one and only one record of a second table. Similarly, the row of a second table can also be related to anyone row of the first table.</p><p>Below is an example to show the one-to-one relationship. A country can have only one capital and the capital belongs to only one country.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/873/0*CJOtEwu0qyudZiUS" /></figure><p><strong>One to many relationship(1:N):</strong></p><p>It is used to create a relationship between two tables. Any single row of the first table can be related to one or more rows of the second table, but the rows of the second table can only relate to the only row in the first table. It is also known as a many-to-one relationship.</p><p>Below is an example to show the one-to-many relationship. A customer can order many items in the restaurant.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*Q4vbIUtMIaHlAuYV" /></figure><p><strong>Many to many relationships:</strong></p><p>Each record in the first table can relate to any records in the second table. Similarly, each record of the second table can also relate to more than one record of the first table. It is also represented as an N: N relationship.</p><p>Below is an example of many-to-many relationships. Here a book can have more than 1 author and 1 author can be written more than 1 book. So here it is a many-to-many relationship. This will include an extra table called the junction table. This table has the primary keys of the books table and the author table.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*OpeBv9SQpwNfjmY1" /></figure><p>Hope you find it useful. Thank you!!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7bbc653870da" width="1" height="1" alt=""><hr><p><a href="https://medium.com/yavar/database-relationships-7bbc653870da">Database relationships</a> was originally published in <a href="https://medium.com/yavar">YavarTechWorks</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Backend Application and its folder structure]]></title>
            <link>https://medium.com/yavar/backend-application-and-its-folder-structure-ed631051faae?source=rss-7f7ad90f7591------2</link>
            <guid isPermaLink="false">https://medium.com/p/ed631051faae</guid>
            <category><![CDATA[backend-architecture]]></category>
            <category><![CDATA[backend-folder-structure]]></category>
            <category><![CDATA[folder-structure]]></category>
            <category><![CDATA[backend]]></category>
            <dc:creator><![CDATA[priya s]]></dc:creator>
            <pubDate>Sat, 29 Oct 2022 14:43:05 GMT</pubDate>
            <atom:updated>2022-10-31T02:24:30.686Z</atom:updated>
            <content:encoded><![CDATA[<p>Hi everyone, in this post, we are going to learn about what is backend application and its folder structure.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/812/1*i5WvjpiqgY4jpjTTP07O_A.jpeg" /></figure><p><strong>Backend Application:</strong></p><p>A back-end application supports front-end user services and interfaces with any required resources. This may interact directly with the front end or it may be called from an intermediate program that mediates front-end and back-end activities.</p><p>The back end also known as the server side, consists of the server which provides data on request, the application that channels it, and the database which organizes the information.</p><p><strong>API:</strong> It is a software intermediary that allows two applications to talk to each other.</p><p><strong>Backend Application Folder Structure:</strong></p><p>Below is the sample folder structure for the library todo application.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/455/1*ZUvGJi_0KJ5cpVBbVQzAvA.png" /></figure><p><strong>Index.js:</strong></p><p>This index.js typically handles the app startup, routing, and other functions of the application.</p><p><strong>.env:</strong></p><p>The dotenv package is used for handling environment variables. These variables can be customized.</p><p><strong>Package.json:</strong></p><p>The package.json file is the heart of any Node project. It records important metadata about a project which is required before publishing to NPM and also it defines functional attributes of a project that npm uses to install dependencies, run scripts, and identify the entry point to the package.</p><p><strong>Package-lock.json:</strong></p><p>This is created for locking the dependency with the installed version.</p><p><strong>Nodemon.json</strong></p><p>It supports local and global configuration files. The file can be used to add some extra configurations to our application to allow us to monitor multiple directories, ignore files, and delay restarting amongst others.</p><p><strong>.sequelizerc:</strong></p><p>This is a special configuration file. This will provide a path to the config file.</p><p><strong>Config.json:</strong></p><p>This is the main configuration file and contains all your default environment variables.</p><p><strong>Controllers:</strong></p><p>The controllers are responsible for handling incoming requests and returning responses to the client. Its main purpose is to receive specific requests for the application.</p><p>For the library todo application, it can have book.controller.js, user.controller.js, and session.controller.js.</p><p><strong>Services:</strong></p><p>The services handle all the logic between the incoming request and returning the response. In the library todo API, the services handle the add, update, list, and deletion logic and send it to the returning response.</p><p><strong>Exceptions:</strong></p><p>It handles the exception errors that arise in the application. For example, session timeout errors.</p><p><strong>Hooks:</strong></p><p>A hook allows the programmer to insert customized programming. This allows you to listen to specific events in the application or request/response lifecycle. For example, token authentication can be done here using a prehandler. The prehandler is a hook in fastify which in invoked by any incoming request.</p><p><strong>Models:</strong></p><p>The models are used to communicate with the database. It is an intermediary between the database and the controllers.</p><p><strong>Routes:</strong></p><p>It has the call route methods and the controller to execute when it is called. It has</p><ol><li>private routes</li><li>public routes.</li></ol><p>In the public routes, anyone can access it. It does not require any authorization. But in the case of private routes, it requires authorization to visit a particular route (for example to read or update the user details).</p><p><strong>Types:</strong></p><p>It defines the type of the payload, request, and response parameters.</p><p><strong>Policies:</strong></p><p>Policies are designed to let you add common types of management capabilities to an API easily and reliably. It provides security. In this example todo application, only an admin has permission to access the books table like add, update, and delete the data from the table. The user is not allowed to access the table.</p><p><strong>Db :</strong></p><p>This folder defines the structures of the tables with the column names and their datatypes. It has two sub-folders.</p><ol><li>Migrations — Migrating databases automatically syncing databases in all of the environments.</li><li>Seeders — Seeding a database is a process in which an initial set of data is provided to a database when it is being installed.</li></ol><p>Thank You! Hope you find it useful.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ed631051faae" width="1" height="1" alt=""><hr><p><a href="https://medium.com/yavar/backend-application-and-its-folder-structure-ed631051faae">Backend Application and its folder structure</a> was originally published in <a href="https://medium.com/yavar">YavarTechWorks</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>