<?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 Isuru Pathum Herath on Medium]]></title>
        <description><![CDATA[Stories by Isuru Pathum Herath on Medium]]></description>
        <link>https://medium.com/@isurupathumherath?source=rss-49138dcfbf31------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*RB1juFogyuAvP2r4OolzgA.jpeg</url>
            <title>Stories by Isuru Pathum Herath on Medium</title>
            <link>https://medium.com/@isurupathumherath?source=rss-49138dcfbf31------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 07:30:00 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@isurupathumherath/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[NoSQL vs SQL (MongoDB vs MySQL)]]></title>
            <link>https://medium.com/@isurupathumherath/nosql-vs-sql-mongodb-vs-mysql-dc11ea3fba64?source=rss-49138dcfbf31------2</link>
            <guid isPermaLink="false">https://medium.com/p/dc11ea3fba64</guid>
            <category><![CDATA[sql]]></category>
            <category><![CDATA[nosql]]></category>
            <category><![CDATA[mysql]]></category>
            <category><![CDATA[mongodb]]></category>
            <category><![CDATA[relational-databases]]></category>
            <dc:creator><![CDATA[Isuru Pathum Herath]]></dc:creator>
            <pubDate>Sat, 14 May 2022 12:08:29 GMT</pubDate>
            <atom:updated>2022-05-14T12:08:29.764Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_cffJsQLBtRVQDz905j1FA.png" /></figure><p>Hi, I am Isuru Pathum Herath. In this blog, I will talk about NoSQL and SQL using MongoDB and MySQL. This will be useful if you are new to SQL or NoSQL. Or if you are looking for the difference between MySQL and NoSQL.</p><p>At the end of this blog, you will be able to identify what is the exact difference between NoSQL and SQL using MongoDB and MySQL. And you will be able to know the use cases of each database structure.</p><p><strong>What you will learn,</strong></p><ol><li>What are SQL and NoSQL</li><li>Different Between SQL and NoSQL</li><li>What are MySQL and MongoDB</li><li>Use cases of each database structure</li></ol><p>Let&#39;s start with knowing SQL and NoSQL first.</p><h3>1. What are SQL and NoSQL?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1012/0*HGj-urzmzJV57Sjy.png" /><figcaption>SQL and NoSQL</figcaption></figure><h4>SQL</h4><p>SQL stands for “<strong>Structured Query Language</strong>”. This language is used for communicating with a database. SQL is the standard language for relational database management systems according to the ANSI(American National Standards Institue). SQL statements are used to conduct operations such as updating or retrieving data from a database. SQL is commonly used in relational database management systems such as Oracle, Sybase, Microsoft SQL Server, Access, Ingres, and others.</p><p>Although most database systems employ SQL, they often have their own proprietary extensions that are exclusively used on their own platform. Standard SQL commands such as “Select,” “Insert,” “Update,” “Delete,” “Create,” and “Drop” may be used to perform nearly anything with a database. This lesson will teach you the fundamentals of each of these commands and provide you the opportunity to practice them using the SQL Interpreter.</p><p><strong>Why do we use SQL?</strong></p><p>SQL is commonly used because it has the following benefits:</p><ol><li>Users can utilize relational database management systems to access data.</li><li>Users can use this feature to explain the data.</li><li>Allows users to define and manipulate the data in a database.</li><li>Allows SQL modules, libraries, and pre-compilers to be embedded into other languages.</li><li>Users have the ability to build and delete databases and tables.</li><li>Allows users to build database views, stored procedures, and functions.</li><li>Permissions for tables, processes, and views can be adjusted by users.</li></ol><h4>NoSQL</h4><p>Rather than relational tables, NoSQL databases store data as documents. As a result, we categorize them as “not simply SQL” and divide them into several flexible data models. Pure document databases, key-value stores, wide-column databases, and graph databases are examples of NoSQL databases. NoSQL databases are designed from the bottom up to store and handle large volumes of data at scale, and they are increasingly used by modern enterprises.</p><p>Instead of the columns and rows required by relational databases, NoSQL databases store data as JSON documents. To be explicit, NoSQL refers to “not just SQL” rather than “no SQL.” This implies that a NoSQL JSON database may store and retrieve data without utilizing SQL. You may also mix JSON’s flexibility with SQL’s capability to get the best of both worlds. As a result, NoSQL databases are designed to be flexible, scalable, and capable of quickly adapting to current commercial data management demands.</p><p><strong>Why do we use NoSQL?</strong></p><p>Customer experience has fast become the most crucial competitive difference, ushering in a period of massive transformation in the commercial world. As part of this change, businesses are communicating digitally on an unprecedented scale — not only with their consumers, but also with their staff, partners, vendors, and even their goods. The internet and other 21st-century technologies enable this contact, and cloud, mobile, social media, big data, and IoT applications are at the center of the transformation.</p><p>Using NoSQL databases has various advantages, including:</p><ol><li>NoSQL databases make it easier to construct interactive real-time online applications, such as those that use REST APIs and web services.</li><li>These databases offer flexibility for data that hasn’t been normalized, needs a flexible data model, or has various features for distinct data types.</li><li>They provide scalability for bigger data volumes, which are common in analytics and AI applications.</li><li>Cloud, mobile, social media and large data applications benefit from NoSQL databases.</li><li>For certain sorts of applications, they are built for specialized use cases and are easier to use than general-purpose relational or SQL databases.</li></ol><h3>2. Different between SQL and NoSQL</h3><p>In the above section, we talked about SQL and NoSQL. I hope that you have a clear image of those database structures. Now let’s see what are the difference between using SQL and NoSQL.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*9Fh_J7YbNcZ2oKUl.png" /></figure><p>SQL databases are general-purpose databases, whereas NoSQL databases are designed for specialized use cases. The five major differences between NoSQL and SQL may be summarized as follows: API, data model, schema need, scalability, and data integrity. To these features of data storage and retrieval, each takes a distinct approach.</p><p><strong>1. API</strong></p><p>Although many NoSQL databases offer a SQL-like query language, SQL is not required as an API for the data in the database. SQL is frequently the main or primary interface to data in SQL databases.</p><p><strong>2. Data Model</strong></p><p>Data is not represented as tables with fixed rows and columns in NoSQL database systems, as it is in SQL database systems. Instead, data can be represented as JSON documents, graphs with nodes and edges, or key-value pairs, depending on the NoSQL database. The table and row idea is used in wide-column storage, although columns can be dynamic from row to row inside a table.</p><p><strong>3. Schema</strong></p><p>A NoSQL database’s schema is flexible, which means the data, data types, and lengths for data pieces are not fixed. Data can be stored in a schemaless or free-form format. This method provides programmers with more freedom, which can make development easier.</p><p>The schema of SQL databases is set in stone, with strict data types and lengths for each column, and every row must conform to the predetermined column layout and structure. If a column is specified as an integer, for example, the DBMS will refuse any attempt to store data other than integers in that column. Because the DBMS enforces rules as data is added, this technique results in higher data quality.</p><p><strong>4. Scalability</strong></p><p>Horizontal scaling, also known as scaling out, is common in NoSQL databases. Scaling out a system entails adding additional hardware, generally in the form of new commodity servers. In NoSQL systems, horizontal partitioning with sharding is commonly used to divide up huge databases into smaller chunks dispersed over numerous servers.</p><p>Vertical scaling, sometimes known as scaling up, is a common SQL method. Vertical scaling involves adding more resources, such as a more powerful CPU or more memory, to manage a greater workload or increase performance.</p><p><strong>5. Data security</strong></p><p>Different mechanisms are used by NoSQL and SQL databases to ensure data integrity when it is generated, read, modified, and removed by applications and users.</p><p>The BASE technique is used by most NoSQL database systems to manage data integrity (Basically Available, Soft State with Eventual Consistency). Data may be inconsistent for a while while using the BASE, but database replication gradually makes all copies of the data consistent. Some programs can handle inconsistencies in data, whereas others cannot.</p><h3>3. What are MySQL and NoSQL?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Dyd-VeHLzjfzWJDQ.png" /></figure><h4>MongoDB</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*XVjiwaqnt6iFywO-" /></figure><p>MongoDB is a document-oriented NoSQL database for storing large amounts of data. MongoDB uses collections and documents instead of tables and rows, as in traditional relational databases. Documents are made up of key-value pairs, which are MongoDB’s fundamental data unit. Collections are the equivalent of relational database tables since they include collections of documents and functions. MongoDB is a database that first appeared in the mid-2000s.</p><p>A glossary of MongoDB terminology is provided here.</p><p><strong>1. _id</strong></p><p>Every MongoDB document must include the field _id. The _id field in a MongoDB document represents a unique value. The _id field acts as the primary key for the document. MongoDB will automatically construct a _id field if you create a new document without one. So, in the case of the aforementioned customer table, Mongo DB will assign each document in the collection a 24-digit unique number.</p><p><strong>2. Collection</strong></p><p>A collection is a collection of MongoDB documents. A collection is the equivalent of a table in any other relational database management system (RDMS), such as Oracle or MS SQL. Within a single database, there is a collection. As stated in the introduction, collections do not impose any organization.</p><p><strong>3. Cursor</strong></p><p>This is a reference to the query’s result set. Clients can retrieve results by iterating through a cursor.</p><p><strong>4. Database</strong></p><p>This is a container for collections, similar to the container for tables in RDMS. Each database receives its own set of files on the file system. A MongoDB server may hold several databases.</p><p><strong>5. Document</strong></p><p>A document is essentially a record in a MongoDB collection. Field names and values will be found in the document.</p><p><strong>6. Field</strong></p><p>In a document, a name-value pair. There are zero or more fields in a document. In relational databases, fields are similar to columns. A Field with Key-Value Pairs is depicted in the diagram below.</p><p><strong>7. JSON</strong></p><p>JavaScript Object Notation (JSON) is a kind of JSON. This is a plain text format for expressing structured data that is human understandable. JSON is now supported by a wide range of computer languages.</p><h4>MySQL</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/848/0*2ZaVF1UG_jK41GCS.jpg" /></figure><p>MySQL is an Oracle-developed relational database management system (RDBMS) based on structured query language (SQL).</p><p>A database is a collection of data that is organized. It might be anything from a basic grocery list to a photo gallery to a repository for a business network’s massive volumes of data. A relational database, in particular, is a digital storage that collects data and organizes it using the relational paradigm. Tables in this architecture are made up of rows and columns, and connections between data items are all organized logically. An RDBMS is a collection of software tools that are used to create, administer, and query a database.</p><h4><strong>Difference between MongoDB and MySQL</strong></h4><p>1. The table in RDBMS comprises the columns and rows that are used to store the data, whereas the collection in MongoDB is the same structure. The collection is made up of documents, which include Fields, which are key-value pairs.</p><p>MySQL — Table</p><p>MongoDB — Collection</p><p>2. In a relational database management system, a row represents a single, implicitly organized data item in a table. The data in MongoDB is saved in documents.</p><p>MySQL — Row</p><p>MongoDB — Document</p><p>3. A column in an RDBMS signifies a set of data values. These are referred to as Fields in MongoDB.</p><p>MySQL — Field</p><p>MongoDB — Column</p><p>4. In RDBMS, data is occasionally dispersed over many tables, and to gain a comprehensive picture of all data, a join between tables is sometimes established. Data is generally saved in a single collection in MongoDB, however, it is segregated using Embedded documents. As a result, MongoDB has no concept of joins.</p><p>MySQL — Join</p><p>MongoDB — Embedded Document</p><h3>4. Use Cases</h3><p>Here, I point to some SQL databases and ideal use cases first. Then let’s see about NoSQL databases.</p><h4>MySQL</h4><ul><li>MySQL is a free, open-source database.</li><li>Database with a large community, significant testing, and a high level of stability.</li><li>All major platforms are supported.</li><li>There is replication and sharding accessible.</li><li>Covers a broad range of scenarios</li></ul><h4>Oracle</h4><ul><li>Professional administration, regular updates, and outstanding customer service are all features of this commercial database.</li><li>The SQL dialect utilized is Procedural Language/SQL or PL/SQL.</li><li>One of the most costly database options available</li><li>Uses massive databases</li><li>Simple improvements</li><li>Controlling transactions</li><li>All operating systems are supported.</li><li>Designed for businesses and organizations with high workloads.</li></ul><h4>Microsoft SQL Server</h4><ul><li>Microsoft Transact SQL, or T-SQL, is the SQL dialect used to design and maintain commercial databases.</li><li>User-friendly only for Windows and Linux</li><li>When faults are discovered, it is difficult to make corrections in the middle of the process.</li><li>It’s ideal for small-to-medium-sized businesses looking for a commercial database solution without the Oracle price tag.</li></ul><h4>PostgreSQL</h4><ul><li>It’s a hybrid SQL/NoSQL database solution since it’s an object-oriented database management system.</li><li>Free and open-source software</li><li>Wide variety of operating systems compatibility</li><li>Many third-party service providers and an active community<br>ACID compliance is high.</li><li>Uses just SQL.</li><li>When your data doesn’t fit into a relational model, this method is preferable. It’s also great for handling massive datasets and conducting complex queries.</li></ul><h4>NoSQL Database Systems</h4><p>With good reason, MongoDB is the most popular NoSQL database. It has the following qualities and benefits:</p><ul><li>Use for free</li><li>Schema changeable</li><li>Vertically scalable</li><li>With simple queries, the performance is excellent.</li><li>Add additional columns and fields without affecting the performance of your application or current rows.</li></ul><p>MongoDB is great for businesses that are experiencing rapid expansion or have a lot of unstructured data. Alternatives to this NoSQL database are less well-known, such as:</p><ol><li>Cassandra by Apache</li><li>BigTable on Google Cloud</li><li>HBase (Apache)</li></ol><p><em>So in this blog, I hope you learned something new. Hope you will stay safe!</em></p><p><em>Let’s meet in another blog. See you..!</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dc11ea3fba64" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[React Application using WebPack with Koa JS Backend for next level node JS Project]]></title>
            <link>https://medium.com/@isurupathumherath/react-application-using-webpack-with-koa-js-backend-for-next-level-node-js-project-242a31229fb5?source=rss-49138dcfbf31------2</link>
            <guid isPermaLink="false">https://medium.com/p/242a31229fb5</guid>
            <category><![CDATA[node]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[koajs]]></category>
            <category><![CDATA[webpack]]></category>
            <dc:creator><![CDATA[Isuru Pathum Herath]]></dc:creator>
            <pubDate>Fri, 13 May 2022 22:16:20 GMT</pubDate>
            <atom:updated>2022-05-13T22:16:20.437Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PPqF0EkF5Yo3OjBqDgBWDA.png" /><figcaption><strong>React Application using WebPack with Koa JS Backend for next level node JS project</strong></figcaption></figure><p>Hi, I am Isuru Pathum Herath. And in this blog, I hope to share the experience of one of my projects that used React JS with WebPack and Koa JS backend. So, I hope you will learn about below mentioned points today with my blog.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*0uuH-h4fhIlAyGus.png" /><figcaption>Top Brands Using React JS</figcaption></figure><p>Today, React JS is one of the most useful and most popular JavaScript frontend libraries with a strong foundation and with large community support and usage. ReactJS is a JavaScript toolkit for creating reusable UI components that are declarative, fast, and versatile. It is an open-source, component-based front-end library that is exclusively responsible for the application’s view layer. It was created and maintained by Facebook and was later utilized in its products such as WhatsApp and Instagram.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*tx5yxRRNwyQNeSLW.png" /></figure><p>Webpack is a static module bundler for contemporary JavaScript applications at its core. When “webpack” analyzes your application, it creates an internal dependency tree from one or more entry points and then merges every module your project requires into one or more bundles, which are static assets from which your content is served.</p><blockquote>I am going to use webpack to create our React Application without using the general “npx create-react-app” command.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*6tuNDh9EaA0a7D83.jpeg" /><figcaption>koa JS Logo</figcaption></figure><p>The team behind Express created Koa, a new web framework that aspires to offer a smaller, more expressive, and more robust base for online applications and APIs. Koa’s use of async functions allows you to avoid callbacks and dramatically improve error handling. Koa’s core does not include any middleware, and it provides an attractive set of functions that make creating servers quick and pleasurable.</p><h3>What you will learn</h3><ol><li>Create a Koa JS backend Server</li><li>How to use Postman check APIs of our backend server</li><li>Create a React Application using WebPack</li></ol><p>Let’s start with creating our backend.</p><h3>1. Create a Koa JS Backend Server</h3><p>Create a new folder named <strong>backend</strong>. First thing first, we need to create our <strong>package.json</strong> file. To create it execute the below command.</p><pre>npm init -y </pre><p>or</p><pre>npm init</pre><p>Then you can fill in your own details as you wish and create the <strong>package.json</strong> file. If you use “<em>npm init -y” </em>it will consider as all <strong>yes </strong>and get the default values into the <strong>package.json</strong> file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*f1zjXwiyjO2Kf9c0VWcFTw.png" /><figcaption>package.json</figcaption></figure><p>Now we need to add necessary dependencies to our Koa JS backend server.</p><p>The first necessary dependency is <strong>koa</strong>. And then install other dependencies like <strong>koa-router, koa-logger, koa-bodyparser, koa-cors, koa-static, koa-mount, and http-status.</strong></p><pre>npm install koa koa-router koa-logger koa-bodyparser koa-cors koa-static koa-mount http-status</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/273/1*DfTyG8Af0Apnf9uvlL77fQ.png" /><figcaption>Project Structure after installing the necessary dependencies</figcaption></figure><p>Make sure to create a .gitignore file. It will not allow uploading unnecessary files and folders to GitHub when you push your project. I add the node_modules folder because it is large and heavy to upload to GitHub.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/729/1*ctaGVZ1YTaK-mxJmsEG9Gw.png" /><figcaption>.gitignore file</figcaption></figure><p>Now create a file named <strong>server.js. </strong>This file contains the server code.</p><pre>const Koa = require(&quot;koa&quot;);<br>const BodyParser = require(&quot;koa-bodyparser&quot;);<br>const Router = require(&quot;koa-router&quot;);<br>const Logger = require(&quot;koa-logger&quot;);<br>const cors = require(&#39;koa-cors&#39;);<br>const serve = require(&quot;koa-static&quot;);<br>const mount = require(&quot;koa-mount&quot;);<br>const HttpStatus = require(&quot;http-status&quot;);</pre><pre>const app = new Koa();<br>const router = new Router();<br>const PORT = 8000;</pre><pre>// Middleware<br>app.use(BodyParser());<br>app.use(Logger());<br>app.use(cors());</pre><pre>//Route<br>router.get(&#39;/&#39;, async (ctx, next) =&gt; {<br>  ctx.status = HttpStatus.OK;<br>  ctx.body = &quot;Koa JS Backend Server Running...!&quot;;<br>  await next();<br>});</pre><pre>app.use(router.routes()).use(router.allowedMethods());</pre><pre>// Open port to listen and display on console<br>app.listen(PORT, function () {<br>  console.log(&quot;Server Started under Port - %s&quot;, PORT);<br>});</pre><p>We need<strong> nodemon</strong> to start our server and run it without interrupting it during running the server.</p><pre>npm i nodemon</pre><p>Then update the <strong>package.json</strong> file by adding the below command to scrips.</p><pre>&quot;start&quot;: &quot;nodemon server.js&quot;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/594/1*kbXzm6kTw5NU3nm1OlwJkw.png" /><figcaption>add nodemon to run the server.js</figcaption></figure><p>The server is ready in our backend. Now let’s check with running it.</p><pre>npm start</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*c0iKrlcEKdKZd91i88d-LQ.png" /><figcaption>server started under port 8000</figcaption></figure><p>Now check by going to this:- <a href="http://localhost:8000/">http://localhost:8000/</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/723/1*yUkmyc5xd1tMC8tPqUJgQg.png" /><figcaption>Koa JS Backend Running..!</figcaption></figure><p>Now create 3 folders named <strong>controller and routes</strong>. I am only going to implement sample CRUD operations for Items.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/270/1*djiUynO5vfjauko-Spblqw.png" /><figcaption>Folder Structure for our full backend project</figcaption></figure><p>I am going to use Map() as our Data Source. But it can be integrated with MongoDB also.</p><p>Create a JS file named <strong>Item.js</strong> inside the <strong>controller </strong>folder.</p><p>1. Add Map to the file.</p><pre>const itemStorage = new Map();</pre><p>2. Implement CREATE function.</p><pre>// Add Item Method</pre><pre>exports.addItem = (req) =&gt; {<br>  let itemId;<br>  if (itemStorage.size == 0) {<br>    itemId = itemStorage.size + 1;<br>  } else {<br>    let max = 1;<br>    itemStorage.forEach((v, k) =&gt; {<br>      if (max &lt; k) {<br>      max = k;<br>      }<br>    });<br>    itemId = max + 1;<br>  }</pre><pre>  const itemDetails = req.body;<br>  const details = { itemId, itemDetails }<br>  console.log(itemId);<br>  console.log(itemDetails);</pre><pre>  try {<br>    itemStorage.set(itemId, details);<br>    return `Item Added under Item ID ${itemId}`;<br>  } catch (err) {<br>    console.log(err);<br>  }<br>}</pre><p>The function is exported directly and let me explain what I have done here.</p><blockquote>First, I get the itemStorage size and generate the itemId. Then I get the requested body from the sent request and save it inside the itemStorage Map. Then return a success message with the itemId we have saved inside the itemStorage. If there is an error with doing the above process. The error will be returned.</blockquote><p>3. Implement the VIEW function.</p><pre>// View Item Method</pre><pre>exports.viewItems = () =&gt; {<br>  try {<br>    const values = Array.from(itemStorage.values());<br>    console.log(values);<br>    return values;<br>  } catch (err) {<br>    console.log(err);<br>  }<br>}</pre><blockquote>In this function, I put all values into an Array and return the array list. If there is an error with it; the error will be returned.</blockquote><p>4. Implement the VIEW BY ID function.</p><pre>// View Item by ID Method</pre><pre>exports.viewItemById = (itemId) =&gt; {<br>  try {<br>    let value;<br>    let check = false;<br>    itemStorage.forEach((v, k) =&gt; {<br>    if (k == itemId) {<br>        console.log(v.itemDetails);<br>        value = v.itemDetails;<br>        check = true;<br>      } <br>    });</pre><pre>    if (check == true) {<br>      return value;<br>    } else {<br>      return &quot;No Data&quot;;<br>  }</pre><pre>  } catch (err) {<br>    console.log(err);<br>  }<br>}</pre><blockquote>Check the itemStorage by itemId and display the data related to the itemId if any. If there is no item under the given itemId. The function will return “No Data”.</blockquote><p>5. Implement the UPDATE function.</p><pre>// Edit Item Method</pre><pre>exports.editItem = (itemId, req) =&gt; {<br>  const itemDetails = req.body;<br>  const details = { itemId, itemDetails }<br>  console.log(itemId);<br>  console.log(details);</pre><pre>  try {<br>    let check = false;<br>    itemStorage.forEach((v, k) =&gt; {<br>    if (k == itemId &amp;&amp; check == false) {<br>      itemStorage.set(Number(itemId), details);<br>      check = true;<br>      }<br>    });</pre><pre>    if (check == true) {<br>      return `Item Updated under Item ID ${itemId}`;<br>    } else {<br>      return &quot;No Data&quot;;<br>    }</pre><pre>  } catch (err) {<br>    console.log(err)<br>  }<br>}</pre><blockquote>Check the itemStorage with the given itemId and then update with the given data by the request. If there is no item under the given itemId, the “No Data” message will be returned.</blockquote><p>6. Implement the DELETE function</p><pre>// Delete Item</pre><pre>exports.deleteItem = (itemId) =&gt; <br>  try {<br>    let check = false;<br>    itemStorage.forEach((v, k) =&gt; {<br>    if (v.itemId == itemId) {<br>      itemStorage.delete(k);<br>      check = true;<br>      }<br>    });<br>    if (check) {<br>      return &quot;Item Removed!&quot;;<br>    } else {<br>      return &quot;No Data&quot;;<br>    }<br>  } catch (err) {<br>  console.log(err);<br>  }<br>}</pre><blockquote>This function is searching for the given itemId and deletes the item details from the itemStorage. Or if there is no data related to the requested itemId, the function will return “No data”. Else returns the success message.</blockquote><p>Now our controller is ready. Let’s implement the route now.</p><p>Create a JS file named<strong> Item.js</strong> inside the <strong>routes</strong> folder. And implement below with below code the file.</p><pre>const Router = require(&quot;koa-router&quot;);</pre><pre>//Import Controllers<br>const itemController = require(&#39;../controller/Item&#39;);</pre><pre>const router = new Router({ prefix: &#39;/item&#39; });</pre><pre>router.get(&#39;/&#39;, ctx =&gt; {<br>  let items = itemController.viewItems()<br>  ctx.body = items<br>});</pre><pre>router.get(&#39;/:id&#39;, ctx =&gt; {<br>  const itemId = ctx.params.id;<br>  let items = itemController.viewItemById(itemId);<br>  ctx.body = items;<br>});</pre><pre>router.post(&#39;/&#39;, ctx =&gt; {<br>  let items = ctx.request;<br>  items = itemController.addItem(items);<br>  ctx.response.status = 201;<br>  ctx.body = items;<br>});</pre><pre>router.put(&#39;/:id&#39;, ctx =&gt; {<br>  const itemId = ctx.params.id;<br>  let items = ctx.request;<br>  items = itemController.editItem(itemId, items);<br>  ctx.response.status = 201;<br>  ctx.body = items;<br>});</pre><pre>router.delete(&#39;/:id&#39;, ctx =&gt; {<br>  const itemId = ctx.params.id;<br>  let items = ctx.request;<br>  items = itemController.deleteItem(itemIds);<br>  ctx.response.status = 201;<br>  ctx.body = items;<br>});</pre><pre>module.exports = router;</pre><p>Now our routes are also done. Next, we need to do some changes to <strong>server.js.</strong></p><ol><li>Import the Routes</li><li>Implement the router Middleware</li></ol><pre>// Import Routes<br>const itemRouter = require(&#39;./routes/Item&#39;);</pre><pre>// Router Middleware<br>app.use(itemRouter.routes()).use(itemRouter.allowedMethods());</pre><p>After adding the code, the server.js is like this. Make sure to remove the unnecessary codes.</p><pre>const Koa = require(&quot;koa&quot;);<br>const BodyParser = require(&quot;koa-bodyparser&quot;);<br>const Router = require(&quot;koa-router&quot;);<br>const Logger = require(&quot;koa-logger&quot;);<br>const cors = require(&#39;koa-cors&#39;);<br>const serve = require(&quot;koa-static&quot;);<br>const mount = require(&quot;koa-mount&quot;);<br>const HttpStatus = require(&quot;http-status&quot;);</pre><pre>const app = new Koa();<br>const router = new Router();<br>const PORT = 8000;</pre><pre>// Middleware<br>app.use(BodyParser());<br>app.use(Logger());<br>app.use(cors());</pre><pre>// Import Routes<br>const itemRouter = require(&#39;./routes/Item&#39;);</pre><pre>// Router Middleware<br>app.use(itemRouter.routes()).use(itemRouter.allowedMethods());</pre><pre>// Open port to listen and display on console<br>app.listen(PORT, function () {<br>  console.log(&quot;Server Started under Port - %s&quot;, PORT);<br>});</pre><p>Now your server is all set up. It’s time to check our APIs are working! To check it, you can use postman. Start the backend server before checking with the postman using the “npm start” command.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1008/1*X5vIEJM3GtyxtmB8Jdoreg.png" /><figcaption>Backend server started</figcaption></figure><h3>2. How to use postman to check APIs of our backend</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*F9qRv7CtzIMIlOAc.jpg" /></figure><p>The Postman testing tool is a full API development platform with a variety of built-in tools that assist each stage of the API lifecycle. The Postman tool allows you to develop, simulate, debug, automate testing, document, monitor, and publish APIs all from one location.</p><p>You can download postman by clicking this <a href="https://www.postman.com/downloads/"><em>link</em></a>.</p><p>First, let’s save an item. To do that you can follow me.</p><p>1. Create a new HTTP Request.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/985/1*lWaPBcJWd9o67bS9YcDXHQ.png" /><figcaption>Postman new request</figcaption></figure><p>1 — Select the Request Type (GET/POST/PUT/DELETE)</p><p>2 — Enter the URL you need to send the request</p><p>3 — You can use this send button to send the request</p><p>4 — Options you can use to send with the request (Header, Authorization token, Body, etc …)</p><p>5 — You will see the response here</p><p>2. Now enter the details we need to send the request as follows.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/938/1*XYNbENhwnTWrZSNWy1yYTA.png" /></figure><p>3. Now send your request.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/941/1*0RMudY29klgrN-iwzM3g4g.png" /></figure><p>You would be able to see the response same as what I have returned.</p><p>Cool..! Now you know how to use postman and you have successfully sent your first request and got your response.</p><p>Now let’s check with View All Items. To do that, use as following.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/943/1*EvfKbN76fdEunpKX9r8iuA.png" /></figure><p>Here you cannot see a body. Yes! Because this is a GET request. Now send it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/939/1*srV_dj_xr1SIasd1TgVe5A.png" /></figure><p>Walla..! Here is the one we added before using the POST request. Now you can test other requests too. For that use the following URLs. Make sure to add a body to the updated one.</p><p><strong>Add Item</strong></p><p>URL — <a href="http://localhost:8000/item">http://localhost:8000/item</a></p><p>Request Type — POST</p><p>Body —</p><pre>{<br>  &quot;itemName&quot;:&quot;Item No 1&quot;,<br>  &quot;itemCount&quot;:100,<br>  &quot;itemPrice&quot;:200,<br>  &quot;traiderId&quot;: 105<br>}</pre><p><strong>View All Items</strong></p><p>URL — <a href="http://localhost:8000/item">http://localhost:8000/item</a></p><p>Request Type — GET</p><p><strong>Get By Id</strong></p><p>URL — <a href="http://localhost:8000/item">http://localhost:8000/item</a>/&lt;ItemId&gt;</p><p>Request Type — GET</p><p><strong>Update Item</strong></p><p>URL — <a href="http://localhost:8000/item">http://localhost:8000/item</a>/&lt;itemId&gt;</p><p>Request Type — PUT</p><p>Body —</p><pre>{<br>  &quot;itemName&quot;:&quot;Updated Item Name&quot;,<br>  &quot;itemCount&quot;:500,<br>  &quot;itemPrice&quot;:500,<br>  &quot;traiderId&quot;: 254<br>}</pre><p><strong>Delete Item</strong></p><p>URL — <a href="http://localhost:8000/item">http://localhost:8000/item</a>/&lt;itemId&gt;</p><p>Request Type — DELETE</p><p>Well..! That’s it about the backend. Now we are going to implement the frontend using <strong>webpack and babel for React</strong>.</p><h3>3. Create React app using webpack and babel.</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*SS-CZN3LsWACVVdi.png" /></figure><p><strong>Setup the React Application</strong></p><p>1. Create a folder where you want to implement your React application.</p><p>2. Now run “npm init” the same as we did in the backend. This will create your package.json file.</p><pre>npm init</pre><p>3. Install React, Axios, path and React Dom</p><pre>npm i react react-dom axios path</pre><p>4. Now create 2 folders inside the project location as “src” and “public”</p><p>4. Create an “index.html” file inside the “public” folder.</p><p>The content of the index.html file is as follows.</p><p><em>index.html</em></p><pre>&lt;html lang=&quot;en&quot;&gt;</pre><pre>&lt;head&gt;<br>  &lt;meta charset=&quot;UTF-8&quot;&gt;<br>  &lt;meta http-equiv=&quot;X-UA-Compatible&quot; content=&quot;IE=edge&quot;&gt;<br>  &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial- scale=1.0&quot;&gt;<br>  &lt;title&gt;Shopping Cart - IT20125516&lt;/title&gt;</pre><pre>  &lt;!-- Load Bootstrap --&gt;<br>  &lt;link   href=&quot;https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css&quot; rel=&quot;stylesheet&quot; integrity=&quot;sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3&quot; crossorigin=&quot;anonymous&quot;&gt;</pre><pre>  &lt;!-- Load FontAwesome --&gt;<br>  &lt;link rel=&quot;stylesheet&quot; href=&quot;path/to/font-awesome/css/font-    awesome.min.css&quot;&gt;</pre><pre>&lt;/head&gt;<br>&lt;body&gt;<br>  &lt;div id=&quot;root&quot;&gt;&lt;/div&gt;<br>  &lt;script src=&quot;main.js&quot;&gt;&lt;/script&gt;<br>&lt;/body&gt;<br>&lt;/html&gt;</pre><p>5. Create an “App.js” file inside the “src” folder.</p><p><em>App.js</em></p><pre>import React from &quot;react&quot;;<br>const App = () =&gt; {<br>  return (<br>    &lt;div&gt;<br>      &lt;h1&gt; React Application Runnig &lt;/h1&gt;<br>    &lt;/div&gt;<br>  )<br>}</pre><p>6. In the root directory (project folder). We need to create “index.js”, “.babelrc”, and “webpack.config.js” files.</p><p><em>index.js</em></p><pre>import React from &quot;react&quot;;<br>import reactDom from &quot;react-dom&quot;;<br>import App from &quot;./src/App&quot;;</pre><pre>reactDom.render(&lt;Routers /&gt;, document.getElementById(&quot;root&quot;));</pre><p><em>.babelrc</em></p><pre>{<br>  &quot;presets&quot;: [<br>    &quot;@babel/preset-react&quot;,<br>    &quot;@babel/preset-env&quot;<br>  ],<br>    &quot;plugins&quot;: [<br>      &quot;@babel/plugin-transform-runtime&quot;<br>    ]<br>}</pre><p><em>webpack.config.js</em></p><pre>const path = require(&quot;path&quot;);<br>module.exports = {<br>  // Select the mode - production or development<br>  mode: &quot;development&quot;,</pre><pre>  // This is the entry point of the application - I used index.js<br>  entry: &quot;./index.js&quot;,<br>  output: {</pre><pre>    // The folder to get the main.js file after generate<br>    path: path.resolve(__dirname, &quot;public&quot;),<br>    filename: &quot;main.js&quot;<br>  },</pre><pre>  target: &quot;web&quot;,<br>  devServer: {</pre><pre>    // This is the expose port of our application <br>    port: &quot;3000&quot;,<br>    static: [&quot;./public&quot;],<br>    open: true,<br>    hot: true,<br>    liveReload: true,<br>    historyApiFallback: true, //Need to call different URLs<br>    publicPath: true,<br>    disableDotRule: true<br>  },<br>  resolve: {<br>    extensions: [&#39;.js&#39;, &#39;.jsx&#39;, &#39;.json&#39;]<br>  },<br>  module: {<br>    rules: [<br>      {<br>        test: /\.(js|jsx)$/,        <br>        exclude: /node_modules/,    // this folder contains the node <br>        packages we are using<br>        use: &#39;babel-loader&#39;         // we use babel-loader<br>      }<br>    ]<br>  }<br>}</pre><p>7. Now edit the scripts inside the “package.json” file with the following code.</p><pre>&quot;start&quot;: &quot;webpack-dev-server .&quot;,<br>&quot;build&quot;: &quot;Webpack .&quot;</pre><p>The section looks like this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/427/1*wJbcVRLX-WLNycI7VemhgA.png" /><figcaption>package.json script update</figcaption></figure><p>Our application is ready to start.</p><p>First, run “npm run build”. Then run “npm start”. This will start your application.</p><p>You can use “Axios” to call backend requests. You can refer to <a href="https://www.npmjs.com/package/axios"><em>this</em></a>.</p><p>And make sure to have an idea with this <a href="https://axios-http.com/docs/intro"><em>link</em></a>.</p><p><em>So in this blog, I hope you learned something new. Hope you will stay safe!</em></p><p><em>Let’s meet in another blog. See you..!</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=242a31229fb5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What is Version Control? And Understand Git and GitHub..!]]></title>
            <link>https://medium.com/@isurupathumherath/what-is-version-control-and-understand-git-and-github-a14719fc8715?source=rss-49138dcfbf31------2</link>
            <guid isPermaLink="false">https://medium.com/p/a14719fc8715</guid>
            <category><![CDATA[git]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[github]]></category>
            <category><![CDATA[gitflow]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Isuru Pathum Herath]]></dc:creator>
            <pubDate>Thu, 17 Mar 2022 14:49:35 GMT</pubDate>
            <atom:updated>2022-03-17T14:49:35.878Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BYARmBUFXxgZn5ZLultWyg.png" /></figure><p>Hi, I am Isuru Pathum Herath. In this blog, I am going to tell you about version control and how to use Git and GitHub.</p><p>The continual process of altering programs is included in software development, and a version control system makes this effort easier. Software engineers utilize version control software to keep track of documentation, configuration files, and source code. It enables developers to keep many versions of software in a secure and orderly manner. With this, a Software Engineer may rapidly determine which version needs to be adjusted and which changes have already been made and need be made.</p><p>At the end of this blog, you will understand why we need version control and what is version control actually. And also you will be able to know about different git flows and usage of Git and GitHub.</p><h4>What you will learn</h4><ol><li>What is Version Control?</li><li>Why do we need version control?</li><li>Benefits of using version control</li><li>Introduction to Git</li><li>Different WorkFlows and usages</li><li>GitHub and Using git with GitHub</li></ol><p><em>So, it’s time to start our journey to dive into version control. Let’s go…!</em></p><h3>What is Version Control?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*CYgHdT96TBpSbPlu.jpg" /><figcaption>What is Version Control?</figcaption></figure><p>The method of recording and controlling changes to software code is known as version control, sometimes known as source control. Version control systems (VCS) are software tools that assist software development teams in managing changes to source code over time. Version control technologies assist software teams in working quicker and smarter as development environments have increased. They are especially beneficial to DevOps teams since they assist to minimize development time and enhance the number of successful deployments.</p><p>In a specific type of database, version control software maintains track of every change to the code. If a mistake is made, engineers may go back in time and compare previous versions of the code to assist address the problem while minimizing disturbance to other team members.</p><p>Version control software is an integral aspect of the professional practices of today’s software teams. Individual software engineers who are used to working with a good version control system in their teams usually notice the tremendous value version control provides them even on modest solo projects. Many developers, once used to the significant benefits of version control systems, would not fathom working without them, even for non-software tasks.</p><h3>Why do we need Version Control?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*rNV9SI7KlSunY93U.jpg" /></figure><p>Software is created to address a user issue. These solutions are increasingly taking many various forms (e.g., mobile, embedded, SaaS) and running in a range of contexts, such as cloud, on-premises, or Edge. Controlling and maintaining diverse versions of application artifacts — from code to configuration and from design to deployment — becomes increasingly complex when enterprises speed the delivery of their software solutions through DevOps. Without comprehensive version control and traceability, velocity is like driving a car without a seatbelt.</p><p>Version control makes it easier for the entire software development team to coordinate, share, and collaborate. Version control software helps teams to collaborate in dispersed and asynchronous contexts, manage code and artifact changes and versions, and handle merge conflicts and related anomalies.</p><h3>Benefits of using version control</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*VCd2sutLUELoNX_w.png" /></figure><blockquote>There are several advantages to adopting a version control system for your projects. This chapter goes through a few of them in depth.</blockquote><h4>Collaboration</h4><p>Without a VCS, you’re usually working on the same set of files in a shared folder. Shouting around the workplace that you are now working on file “sample.java” and that your colleagues should keep their fingers off the keyboard is not an acceptable workflow. It’s incredibly error-prone since you’re effectively performing open-heart surgery all the time: someone will overwrite someone else’s modifications sooner or later.</p><p>With a VCS, everyone in the team has complete freedom to work on any file at any time. Later on, the VCS will allow you to integrate all of the modifications into a single version. There’s no doubt about where the most recent version of a file or the entire project is. It’s in a common and central location: your VCS.</p><h4>Concurrent Development</h4><p>Projects are becoming increasingly sophisticated. There is an increasing requirement to maintain numerous versions of code and data — and even entire products.</p><p>This implies that numerous engineers and designers may work on the same set of files without fear of duplicating effort or overwriting other team members’ work.</p><h4>Automation</h4><p>Today’s development teams prioritize higher quality and better productivity. And your team may achieve your objectives by automating processes like testing and deployment.</p><p>Continuous Integration (CI) with automated builds and code reviews is a common operating method in software development.</p><h4>Restoring Previous Versions</h4><p>Being able to restore previous versions of a file (or even the entire project) basically implies one thing: you can’t make a mistake! If the adjustments you’ve made recently turn out to be shambles, you can easily undo them with a few mouse clicks. Knowing this should put you at ease when working on critical parts of a project.</p><h4>Tracked Changes</h4><p>Your VCS asks you to provide a brief summary of what was changed each time you save a new version of your project. You may also check what was modified in the file’s content. This allows you to see how your project changed between versions.</p><p>Every development team must be aware of changes. It is critical to keep track of who, what, when, and why modifications are made.</p><p>Version control software takes this precise information and stores it indefinitely. As a result, everyone has access to who is working on what — as well as the modifications that are made.</p><h4>Backup</h4><p>A benefit of adopting a distributed VCS like Git is that it may serve as a backup; each team member has a full-fledged version of the project on his disk, replete with the project’s history. If your beloved central server fails (and your backup disks fail), all you need for recovery is a local Git repository hosted by one of your peers.</p><blockquote>Personally, I faced this advantage usage of version control. Once I lost all the project data because of an issue with my personal computer. But luckily, the source code was stored in my version controlling platform (GitHub).</blockquote><h4>High Availability</h4><p>Your product development crew is your most costly asset. They can’t be idled since they no longer have access to the code.</p><p>You may have a duplicate of your company repository running in another place with the correct version control software. If something goes wrong, you may simply switch to a duplicate of the master for continuous availability.</p><h3>Introduction to Git</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*mb_TmXZoPi5KcgV4.png" /><figcaption>Introduction to Git</figcaption></figure><p>Git is a source code management technology used in DevOps. It is a free and open-source version control system that is used to efficiently manage small to extremely big projects. Git is a version control system that allows several developers to collaborate on non-linear development by recording changes in the source code. Linus Torvalds founded Git in 2005 to aid with the development of the Linux kernel.</p><ul><li>Git is a version control system that is used to track changes to source code.</li><li>The distributed version control technology is used to manage source code.</li><li>It enables numerous developers to collaborate.</li><li>It encourages non-linear evolution due to its hundreds of parallel branches.</li></ul><p><strong>Before we go any farther, let’s go through a situation that happened before Git</strong></p><ul><li>Developers used to submit their code to the central server without having their own copy.</li><li>Any modifications made to the source code were undisclosed to the other developers.</li><li>There was no communication among the developers.</li></ul><p><strong>Let’s have a look at the scenario after Git</strong></p><ul><li>Every developer has a complete copy of the code on their own machines.</li><li>Others can track any modifications made to the source code.</li><li>The developers communicate on a frequent basis.</li></ul><h4><strong>Features of Git</strong></h4><ul><li>Tracks history</li><li>Free and open source</li><li>Supports non-linear development</li><li>Creates backups</li><li>Scalable</li><li>Supports collaboration</li><li>Branching is easier</li><li>Distributed development</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*-2mc6XqgosFS5G5x.jpg" /></figure><h3>Different WorkFlows and Usage</h3><p>There are several workflows to use git in different version control systems. The developers and DevOps teams are able to choose the best of them for their organizations to start work with version control.</p><ol><li>Git flow</li><li>GitLab Flow</li><li>GitHub Flow</li></ol><h4>Git Flow and Problems</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*LJpjZhJMwp7X99hx.png" /><figcaption>Git Flow WorkFlow</figcaption></figure><p>Git flow was one of the earliest suggestions to use Git branches, and it drew a lot of attention. It recommends a primary branch and a separate development branch, as well as supporting branches for features, releases, and hotfixes. The development begins on the development branch, then advances to the release branch, and lastly to the main branch.</p><p>Git flow is a well-defined standard, but its complication causes two issues. The first issue is that developers must utilize the development branch rather than the main branch. The main directory is designated for code that has been disclosed to the public. It is common practice to refer to your default branch as main and to generally branch from and merge to this. Because most tools utilize the main branch as the default, having to switch to another branch is inconvenient.</p><p>The complexity caused by the hotfix and release branches is the second issue with Git flow. These branches may be a good concept for certain companies, but they are overkill for the great majority. Because most firms now employ continuous delivery, your default branch may be deployed. Continuous delivery eliminates the requirement for hotfix and release branches, as well as the associated formality. The merging back of release branches is an example of this procedure. Though specific tools exist to address this issue, they need documentation and add complexity. Developers frequently make mistakes such as merging changes exclusively into the main branch rather than the development branch. The cause of these issues is that the Git flow is rather cumbersome for the majority of use cases. Many projects, for example, perform releases but do not require hotfixes.</p><p>reference: <a href="https://docs.gitlab.com/">https://docs.gitlab.com/</a></p><h4>GitLab Flow</h4><p>GitLab Flow is a more straightforward alternative to GitFlow that mixes feature-driven development and feature branches with issue tracking. With GitLab Flow, all features and fixes are applied to the main branch, while production and stable branches are enabled. GitLab Flow contains a collection of best practices and recommendations to ensure that software development teams follow a seamless approach to jointly ship developments.</p><p>Developers use GitFlow to establish a development branch and set it as the default, whereas GitLab Flow works with the main branch right away. GitLab Flow has a pre-production branch for issue fixes before merging changes back to the main branch and moving to production. Teams may create as many pre-production branches as they require, such as from main to test, test to acceptance, and acceptance to production.</p><p>Teams essentially practice feature branching while simultaneously keeping a distinct production branch. When the main branch is ready for deployment, users merge it into the production branch and push it out. GitLab Flow is frequently used in conjunction with release branches. Teams that want a public API may need to keep multiple versions on hand.</p><p>For more details about GitLab Flow in different branches; <a href="https://docs.gitlab.com/ee/topics/gitlab_flow.html">Please Click Here</a>.</p><h4>GitHub Flow</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ys_PDE5vLpbPfeVq.png" /><figcaption>GitHub Flow</figcaption></figure><p>GitHub flow is a branch-based workflow that is lightweight. Everyone, not just coders, can benefit from the GitHub flow. For example, GitHub flow is used for our site policy, documentation, and roadmap.</p><blockquote>Now You know about git and git workflows. So, it’s time to move to GitHub and see how to use git with GitHub.</blockquote><h3>GitHub and Using git with GitHub</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*XxgJ6S-agyzZN12K.jpeg" /><figcaption>GitHub and Git</figcaption></figure><p>GitHub is a version-control and collaboration tool for software engineers that are accessible over the web. In June 2018, Microsoft, the largest single contributor to GitHub, announced a $7.5 billion acquisition of GitHub. GitHub, which operates on a software-as-a-service (SaaS) basis, was launched in 2008 on Git, an open-source code management system developed by Linus Torvalds to speed up software development.</p><p>GitHub is used to store a project’s source code and track the entire history of all changes made to that code. It makes it easier for developers to cooperate on a project by offering tools for handling potentially contradictory modifications from various developers. GitHub allows developers to edit, adapt, and enhance software from its public repositories for free, but it charges for private repositories, with a variety of premium options available. Each public or private repository contains all of the files in a project, as well as the revision history for each file. Repositories can be public or private, and they can have several collaborators.</p><h4>Using GitHub with Git</h4><p>We can create a free account on <a href="https://github.com/">GitHub</a>. And start working with our version controlling system(GitHub). Let’s see how we can use GitHub with Git commands and other ways to use GitHub with modern advanced technologies.</p><p><strong><em>First Let’s talk about how to create a GitHub Repository and Upload our Source Code to GitHub.</em></strong></p><p>1. Go to <a href="https://github.com/">GitHub</a> and create an account if you don’t have one or you can log in to the GitHub account.</p><p>2. Then click on the <strong><em>profile icon on the top right corner</em></strong> of the GitHub page. And click <strong><em>Your Repositories</em></strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*vTXZqFwxRp-NWQCv.png" /><figcaption>Go to Repositories</figcaption></figure><blockquote><em>Now you can see your all repositories that currently have or maybe there is no repository if you are new to GitHub. No worries..! Let’s create a new one now.</em></blockquote><p>3. Click on the <strong><em>New</em></strong> button. Then you will be redirected to the repository-creating page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ET_weNqJ-2LnPvXB.png" /><figcaption>Create a new Repository</figcaption></figure><blockquote><em>Here you can give a repository name, description, select private or public, and create the repository.</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/784/0*9eoz2CqJDlWbzPXF.png" /><figcaption>Create new repository</figcaption></figure><p>Click <strong><em>Create repository</em></strong>.</p><blockquote><em>Now you can see the repository you created.</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*A3AzJlkmKwtim-5E.png" /></figure><p>Cool…!</p><p>You have created your repository. Now let’s see how to push our code into this GitHub repository from our local machine. I use my own created project to continue with this tutorial.</p><p>You can use the command mentioned in the GitHub repository page after creating the repository. However, I am going to mention all these commands in this step.</p><p>1. Go to the folder your code is stored in your local machine.</p><p>2. Right-click and open <a href="https://git-scm.com/downloads"><strong><em>git bash</em></strong></a><strong><em> </em></strong>and use the below commands one by one. (Install<a href="https://git-scm.com/downloads"> git bash</a> if you are not installed in your machine)</p><pre>git init<br>git add .<br>git commit -m &quot;first commit&quot;<br>git branch -M main<br>git remote add origin &lt;Your Repository HTTPS URL&gt;<br>git push -u origin main</pre><p>Wooo..!</p><p>Now it’s done. Go to your GitHub repository and refresh the page. Your whole code is there!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*JGZsq48_cEvh0cmz.png" /></figure><p><strong><em>Now let’s see how we can merge branches.</em></strong></p><p><strong>Before merging branches, I want to create a new branch. To do that,</strong></p><p>1. Go you your repository and click on branches.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gQ9HtM4MXAUMgIrJOrRy9Q.png" /></figure><p>2. Now You are able to type a branch name and create it from the <strong>main </strong>branch.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/471/1*RjWhBNLmkhSMBFrunVTMWg.png" /></figure><p>3. After creating the new branch, you are able to see this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GvKgzf3XTvXyFjezDHdVmQ.png" /></figure><blockquote>We learned how to create a branch using GitHub. You can also use git commands to create a branch locally and push it into GitHub. For that, you can follow these commands.</blockquote><pre>git branch feature/development origin main<br>git checkout feature/development<br>git push -u origin feature/development</pre><p>Or You can use,</p><pre>git checkout -b feature/development origin main<br>git push -u origin feature/development</pre><p><strong><em>Now We need to create a pull request to merge branches. For that,</em></strong></p><p>1. Go you your repository and click on the “pull request”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TE-Zh1Svtstwl8A_wCHrVQ.png" /></figure><p>2. Click on “New Pull Request”. Or if you have any pull requests, you can see them under pull requests.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PGsJTlgceuev4QW0BkBOBA.png" /></figure><p>3. Now you can select from which branch you need to merge into a selected branch. So here I want to merge from the “feature/develop” branch to the “main” branch. Here you can see all the changes between selected branches.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*awM7MNrgrceLX_x6Xyxmfw.png" /></figure><p>Now, Click the “Create pull request” button.</p><p>4. Before creating the pull request, you can give a Name and Comment.</p><blockquote>Note: You can assign reviewers, add assignees, add labels, projects, and milestones.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CZwk4oOCeyKKQFPILTJY_A.png" /></figure><p>Now press “create pull request”.</p><p>Wallah..! Now you have created your pull request.</p><p>Now you can merge it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jBWrrdq0mYRsehGO3eZONw.png" /></figure><blockquote>After Merge You can delete the feature branch and your code is merged to the given branch.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Zjt3iiUIyUOvnQckYGNi1Q.png" /></figure><p>So that’s how to work with GitHub using Git.</p><blockquote>So in this blog, I hope you learned something new. Hope you will stay safe!</blockquote><blockquote>Let’s meet in another blog. See you..!</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a14719fc8715" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Deploying a nodeJS Application on Azure App Service using ACR]]></title>
            <link>https://medium.com/ms-club-of-sliit/deploy-a-nodejs-application-on-azure-app-service-using-acr-6833a6ec0921?source=rss-49138dcfbf31------2</link>
            <guid isPermaLink="false">https://medium.com/p/6833a6ec0921</guid>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[git]]></category>
            <category><![CDATA[github]]></category>
            <category><![CDATA[azure]]></category>
            <category><![CDATA[deployment]]></category>
            <dc:creator><![CDATA[Isuru Pathum Herath]]></dc:creator>
            <pubDate>Sat, 26 Feb 2022 11:59:22 GMT</pubDate>
            <atom:updated>2022-04-08T01:53:09.029Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iHHDlqZhXFR7QXcC2mrmxw.png" /></figure><p>Hi, I am Isuru Pathum Herath. In this blog, let’s talk about how to deploy a nodeJS application on Azure App Service using Azure Container Registry.</p><p>This is the high-level architecture we follow today.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QWpeoP_fi2NhpNJ4AwkwUA.png" /></figure><p>Here you can see the above image shows the steps that the app deployment is going with. Let me explain the way we go on.</p><p>First, the developer pushes his/her code to the version controlling system. It will trigger to run the pipeline in Oracle Wercker. The pipeline will build the docker image that we want to push to the Azure Container Registry (ACR). After building the docker image, it will be pushed into the ACR by the pipeline. After ACR got the new version of the image. It will be automatically deployed in Azure App Service. All the steps of the Oracle Wercker Pipelines are monitored and notified if there is a failure or successful deployment to Slack.</p><p>After integrating the above architecture, the developer only needs to push their code to the version controlling system. Everything will be automatic until the app is deployed in Azure App Service.</p><h4>What you will learn</h4><ol><li>Version Control</li><li>Oracle Wercker</li><li>Build a docker image using Wercker</li><li>Push the built docker image to ACR</li><li>Deploy the application on Azure App Service on ACR</li></ol><p><em>Now let’s move on with our practical tutorial. But not only the practicals I want to explain tools and technologies I use here a little bit. I hope it will be helpful to get a better understanding of what we actually go through..!</em></p><h3>Version Control</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/932/0*cTrNEADme70iIKVw.png" /><figcaption>Version Controlling Tools</figcaption></figure><p>The method of recording and controlling changes to software code is known as <strong>version control</strong>, sometimes known as<strong> source control</strong>. Version control systems (VCS) are software tools that aid software development teams in <strong>managing source code change over time</strong>. You and your team are able to work together using a version controlling system. It makes it so easy to manage your code together without conflict code with each other. There are many version control systems today but I will mention only the most popular version controlling systems here.</p><p>Examples: GitHub, GitLab, Bitbucket,</p><p>Git is used as the tool we always used for version control.</p><p>I use <strong>GitHub </strong>as the version controlling system in this blog.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/797/0*1ngzZAlHmnhaY8GX.png" /></figure><blockquote>Now you know why version control is used and what we are going to use. Let’s create a React Application before continuing our tutorial.</blockquote><h3>Create a React Application</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/725/0*ciSWS5CmuR1Ri0i7.jpg" /></figure><p>React is a front-end JavaScript toolkit for creating user interfaces using UI components that is free and open-source. Meta and a community of individual developers and businesses support it. React may be used to create single-page or mobile applications as a foundation.</p><p>If you want more details about full-stack web development, <a href="https://medium.com/@isurupathumherath/understanding-full-stack-web-application-development-with-applying-engineering-principles-and-6ea1f02a44ec">click here to read more about Full Stack Web Application Development with applying engineering principles and practices.</a></p><p><em>Let’s move on!</em></p><p><strong><em>I am using Visual Studio Code (VS Code)as the compiler to continue this blog. If you have already created a NodeJS application, you can skip this step.</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/329/0*n4QyN6ziXHmv5nfW" /></figure><p><strong>Open VS Code and get the terminal. </strong>Then <strong>Search for VS code</strong> on your computer and <strong>open it.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/982/1*mq2I9UY_ohlpI7bSMWsdHA.png" /><figcaption>Open VS Code</figcaption></figure><p><strong>Go to files → New Folder and select a folder</strong> as the project location.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ksj6ArF72RcSaLRI-ys0QA.png" /><figcaption>Open Folder</figcaption></figure><p>After opening the folder you selected, the VS code will show the folder name like this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Q9nTWhwaR-F9NYk-31erlA.png" /><figcaption>Folder Name</figcaption></figure><p>Now <strong>open a terminal on VS code</strong> in the <strong>terminal → new terminal</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7lkotnQDxbXgc8Ue5tAOYQ.png" /><figcaption>Open Terminal</figcaption></figure><p>Now<strong> type the below command </strong>to create a react app<strong>. </strong>This command will download all default node modules that they need to the react application.</p><p>Make sure that you have to <a href="https://nodejs.org/en/">install node JS</a> on your computer.</p><pre>npx create-react-app .</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AAviWJLJv3LveCNCIkLBSA.png" /><figcaption>Download Node Modules</figcaption></figure><p>After downloading all the components. <strong>Start the application</strong>.</p><pre>npm start</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Xlq1lbt_GGFrQw6Gad34WA.png" /><figcaption>Started React Application</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Cg40w3YZC0ZON4ABP1uiow.png" /><figcaption>React Application</figcaption></figure><p><strong><em>You can see the react application is running on port 3000 in localhost.</em></strong></p><blockquote>Cool..! You created your react application. Now let’s push this to GitHub.</blockquote><h3>Push the source code to GitHub</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/882/0*-gXBcV_K95FqXpTG.png" /><figcaption>GitHub with Git</figcaption></figure><p>First We need to create a repository on <a href="https://github.com/">Github</a>. Open your GitHub account and create a new repository.</p><p><strong>Go to Your Repositories</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oza91H78SNB7AGqHNc4Dpw.png" /><figcaption>Open Your Repositories</figcaption></figure><p>Click <strong>New</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bsQ_SMAGfdxRkb6oG6CCSQ.png" /><figcaption>Create a new repository</figcaption></figure><p>Now <strong>fill in details</strong> and click <strong>create repository.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/775/1*Iinq_6kN77hEDP9FhFvXZQ.png" /><figcaption>Create a new Repository</figcaption></figure><p>Now the repository has been created.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aHcbgSfqLAWRaIYjpzvgPw.png" /><figcaption>New Repository</figcaption></figure><blockquote>Now let’s move our source code into this repository. Follow me.</blockquote><p><strong>Right-click on the folder</strong> that the react project has created. Then <strong>open gitbash</strong>.</p><blockquote><strong>Make sure to install gitbach on your computer.</strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Mb1_rg36MNVX0ztdpW1nCA.png" /><figcaption>gitbash</figcaption></figure><p>Use the following commands to push your code to the GitHub repository you created.</p><pre>git init<br>git add .<br>git commit -m &quot;first commit&quot;<br>git branch -M main<br>git remote add origin &lt;your repository url&gt;<br>git push -u origin main</pre><p>After running all the codes. Refresh your GitHub repository. Then you can see the source code has been pushed to the GitHub repository you created.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cK0EkvfHnLJjPV1VKG6RWg.png" /><figcaption>Pushed Source Code</figcaption></figure><blockquote>Now you know how to create a GitHub repository and How to push your code from the local computer to the GitHub repository.</blockquote><blockquote>Now let’s create an Oracle Wercker pipeline to build a docker image, push the docker image to the ACR.</blockquote><h3>Create Oracle Wercker Pipelines</h3><p>I recommend you to follow <a href="https://medium.com/ms-club-of-sliit/deploy-a-nodejs-application-in-heroku-using-wercker-pipeline-github-704ae42cc86f"><strong>this blog that I have written about <em>Deploying a NodeJS Application on Heroku</em> for the basics of Wercker Pipelines</strong></a>.</p><p>After creating an application on Wercker, you can see your application like this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FWEla62MRQNGO9fUNxPLkw.png" /></figure><p>Now let’s create the <strong>wercker.yml</strong> file inside our project. This file contains the all necessary steps, commands, and pipeline details for the Oracle Wercker tool.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/348/1*_9_7J1oD4VUvJP5oU4vrkA.png" /><figcaption>Create wercker.yaml</figcaption></figure><blockquote>Make sure to create the YAML file on the root folder.</blockquote><pre>box: node<br>build:  <br>  steps:    <br>    - npm-install    <br>    - script:        <br>        name: echo nodejs information        <br>        code: |          <br>            echo &quot;node version $(node -v) running&quot;          <br>            echo &quot;npm version $(npm -v) running&quot;</pre><p>Use this code segment to run npm install and check the node version and npm version using the Wercker Pipeline.</p><blockquote>Write the code inside your wercker.yml file and push the code to GitHub.</blockquote><p>Save the file and follow the below-mentioned commands to push to GitHub.</p><pre>git add .<br>git commit -m &quot;created wercker yaml&quot;<br>git push</pre><p>Then go to Wercker again. You can see a pipeline is running like this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WNTc6iLITyHf1DnsKVo0vg.png" /><figcaption>build pipeline running</figcaption></figure><p>After running the pipeline you can see everything is fine. If the pipeline is failed it shows a red color line without the green.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kVp3uZU_vnOjGHUjdZDd_g.png" /></figure><p>Now we need to build the docker image. To do that use the below code segment inside the wercker.yml file.</p><pre>build-docker-and-push-to-acr:  <br>  steps:    <br>    - internal/docker-build:<br>        dockerfile: Dockerfile<br>        image-name: credit-bill-frontend<br>    - internal/docker-push: <br>        image-name: credit-bill-frontend<br>        username: $USERNAME   <br>        password: $PASSWORD <br>        registry: azurecontainerisuru.azurecr.io <br>        repository: $USERNAME/credit-bill-frontend</pre><p>Don’t commit this!. We have to do a few things before committing this code.</p><p>Look at the code. We must provide a Dockerfile to build the docker image. So first let’s create the Docker file.</p><p>Create a fine name “<strong>Dockerfile</strong>” in the <strong>root</strong> same as we created the wercker.yml file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/364/1*DQAgBKTsHu4An1eh4kyp5Q.png" /></figure><p>And this is the code we want to use to create a docker image.</p><pre>FROM public.ecr.aws/docker/library/node:16.14.0-alpine3.14 AS build_image<br>RUN apk add --no-cache nodejs npm<br>WORKDIR /isuru<br>COPY package.json ./<br>RUN npm install<br>COPY . .<br>RUN npm run build</pre><pre>FROM public.ecr.aws/docker/library/node:16.14.0-alpine3.14<br>WORKDIR /webapp<br>COPY --from=build_image /isuru /webapp/<br>EXPOSE 3000<br>CMD [ &quot;npm&quot;, &quot;start&quot; ]</pre><p>Then again see there are some <strong>username, password, and registry</strong> fields are there. <strong><em>To have the username and password and the registry URL we need to create an Azure Container Registry in Azure Cloud.</em></strong> Now let’s move to do it.</p><ol><li>log in to the <a href="https://portal.azure.com/"><strong>Azure Portal</strong></a> using this link <a href="https://portal.azure.com/">https://portal.azure.com/</a></li><li>Now search for “<strong>Container Registries</strong>” on the search bar.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*80IigROZ1Mviy2o6DaR7-A.png" /></figure><p>3. Click on “<strong>Container Registries</strong>” and You will see the container registries page.</p><p>Here I still don’t have a container registry.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2T3sp2PrCQ6vXqkoeoX62A.png" /></figure><p>4. Click on “<strong>Create</strong>” or “<strong>Create container registry</strong>” to create a new container registry.</p><blockquote>You will see a new window to provide some details to create a container registry.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oYcZYLSTV2jyfiQPgAyqNA.png" /></figure><p>First is the Basic Information.</p><ol><li>Create a resource group</li><li>Enter a name for the registry</li><li>Select a location</li><li>Select the package you want</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/857/1*r9Bbh3bh2j_Xdf9zK8pltg.png" /></figure><p><strong>Next, go to Networking</strong>. But nothing here to change.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/862/1*9HgkRzNxp2rdDBM1JnZfSA.png" /></figure><p><strong>Now go to Encryption</strong>. Same as before we are fine with default settings.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/821/1*H_JIBHPxLz-xkGy5xKp8wA.png" /></figure><p>Now let’s go to <strong>Tags</strong>. But I’m not going to use tags in here. If you wish to use tags, use them.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/781/1*4tYMuf58KhIjaeIhEUMSsw.png" /></figure><p>Now <strong>Review + Create. </strong>This will take some time to validate your setting and then you will be able to create the registry by pressing <strong>Create </strong>button<strong>.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/865/1*fiFYYC2Rv6l6rcYQmCdZkw.png" /></figure><p>After validation is passed. Click <strong>Create. </strong>This may take a few seconds or minutes according to the connectivity and some other reasons.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CmADXAfDruYApYOcQHSKaQ.png" /></figure><p>Congratulations..!</p><p>Now your container registry has been created successfully. <strong>Go to Resource</strong> now.</p><p>Now go to <strong>repositories </strong>to check whether is there any repository inside.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WBD3SWReF1BJ9DlWxrkIdg.png" /></figure><p>But you can see that this is empty because we didn’t push any docker image to our newly created container registry.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/950/1*ApHX0-V2kkPMUacqnxVnHA.png" /></figure><p>Now we want to <strong>find the username and password that we must provide in the Wercker Pipeline</strong>.</p><ol><li>Go to Access Keys</li><li>Enable Admin User</li></ol><p>Here you are able to see the username and two passwords. You can use any password. I am going to use 1st one.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gpnT7qSszOkespQGyQ6Ddw.png" /></figure><p>Now we found the username and password. But where to apply those?</p><p>We have only one pipeline named “build” in the application we created in the Wercker tool. That is the one we used to run the first pipeline.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kFdfzG2czza_nISo0HIAew.png" /></figure><p>But for now, we have another pipeline named “build-docker-and-push-to-acr”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/773/1*QnlJNgrPr3h-NgMnPiDaZA.png" /></figure><p>We are going to create that pipeline now. Inside that pipeline, we mention the username and password as Pipeline environment variables.</p><p><strong><em>Go to Wercker and select workflows.</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QP1XUy87yx_l2gPDLGtueg.png" /><figcaption>Wercker Application</figcaption></figure><p>Here you are able to see the all pipelines. As I mentioned earlier. There is only one pipeline is there named “build”. Let’s create our new one.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UhfFzpYfrfzg7XxqC6TpOw.png" /><figcaption>Workflows</figcaption></figure><p><strong>Click on Add new pipeline and fill in the details</strong> with going next.</p><blockquote>The name must be the name of the pipeline mentioned in the wercker.yml file.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mhQrxXFl-5mtdQPaVqi9AQ.png" /><figcaption>Create a new pipeline</figcaption></figure><p>After creating the pipeline you can add pipeline environment variables.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Zr0HNVLbCPcKbc9r-x8rCw.png" /><figcaption>Pipeline environment variable</figcaption></figure><p>before pushing, the code to GitHub make sure to change the registry URL in the wercker.yml file.</p><p>After adding the variables. Go to workflow again to bind the new pipeline to the “build” pipeline.</p><p>Click on the <strong>plus button</strong> (+) and follow the below steps.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Byt7DhKu99DDtc-hl0M_2A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/809/1*-zGlELaLXjIiG3YZb6aZ-A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/784/1*ftaUb0JPPRbkuG0uGQa0Cw.png" /><figcaption>Add a new pipeline to the current workflow</figcaption></figure><pre>registry: isurupathumherath.azurecr.io</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jDWub5km3x2B6u4V4qO_AA.png" /><figcaption>Overview</figcaption></figure><p>It can be used in the <strong>Overview </strong>of the container registry.</p><p>Now it is time to push your code to GitHub.</p><pre>git add .<br>git commit -m &quot;added dockerfile and updated wercker yaml file&quot;<br>git push</pre><blockquote>No go back to the Wercker tool and see that you can see 2 pipelines are started to run.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ptCHOO8IzMkGrqfnq0AxCg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ieoc7M1hgrDDmWtPc37fng.png" /><figcaption>Running and completed pipelines</figcaption></figure><blockquote>After the pipelines are running successfully. Now go to the Azure Container to see whether our docker image has been pushed successfully.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/992/1*o51qD3yaeTD7jLoYl-eiHw.png" /><figcaption>New Image in ACR</figcaption></figure><blockquote>Yes..! It is pushed to ACR successfully.</blockquote><blockquote>It’s time to deploy our application on Azure App Service with ACR.</blockquote><h3>Deploy NodeJS Application in Azure App Service with ACR</h3><p>Search for the “<strong>App Service</strong>” and<strong> open the App Service</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ioKdV_ZG8NAcYhauPn4Q9w.png" /><figcaption>Search App Services</figcaption></figure><p>After opening the app service you can see there is no app is running for now.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lZO8iaCZRAbcDmsiaJx2wQ.png" /><figcaption>App Services</figcaption></figure><blockquote>Let’s create a new app.</blockquote><p>Click the “<strong>Create</strong>” or “<strong>Create app service</strong>” button.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/768/1*bSBzFJgtt5YoB-OXKznISQ.png" /><figcaption>Create Web App</figcaption></figure><p>Make sure to select <strong>Docker Container</strong> as Publish. Now let’s go to <strong>Docker</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/801/1*2lE_7JDY5lbQ5rVmLe-udg.png" /><figcaption>Create Web App</figcaption></figure><ol><li>Select Option as <strong>Single Container</strong></li><li>Image Source is <strong>Azure Container Registry</strong></li><li>Then select your container registry and the name of the image you pushed.</li></ol><p>Now <strong>Create + Review.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/769/1*1IFfrZgKRNHMqtNNbClf_g.png" /><figcaption>Create Web App</figcaption></figure><p>Now you are able to <strong>create </strong>the application.</p><blockquote>After the app is created. Go to Resource.</blockquote><p>Now try this URL that you can access to your React Application. Yes..! It is working now.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yjyYcoMs51DkvsW8y-IRjg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LfD86WiZngRGYFwNB5fScw.png" /><figcaption>Deployed React Application on Azure App Service</figcaption></figure><p>But what happens if you push a new version of your code. To make <strong>continuous deployment</strong>, there are some configuration settings to configure.</p><p>Go to <strong>Deployment Center</strong>. And under <strong>settings</strong>, you can see Continous Deployment. <strong>Turn ON</strong> it and <strong>Save</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5HnHB_MFGQ-viKQrllplsg.png" /><figcaption>Deployment Center</figcaption></figure><blockquote>Now you can try to change the source code and let it deploy automatically.</blockquote><p>I am going to add my name to the react application and push it to GitHub. Let’s see will it work.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RsoOUIeU6RaZsro1AC0c7g.png" /><figcaption>Code Changed</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/754/1*E7doAshvhS-hNQj0a4oceg.png" /><figcaption>pushed to GitHub</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CgfkJSNWT5OeRZeWDFtydg.png" /><figcaption>Pipeline Started to Run</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lAB4JH31lOKIPQKQpD7V9A.png" /><figcaption>Pipelines are Success</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iiM7VRJBBioBvWCsO_sFSw.png" /><figcaption>In the logs of the Azure App we created, it is deploying the new version of the application using the docker image we pushed to the ACR</figcaption></figure><p>This may take some time to deploy the new version. We can see the new version of our application after the deployment is completed successfully.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MlOlXCDXPYwZ4dk1oEd37g.png" /><figcaption>New Version</figcaption></figure><blockquote>Here we go…! We are successfully deployed our new version.</blockquote><h3>Integrate Slack Notification to Oracle Wercker Pipelines</h3><p>A blog for slack integration is coming soon..! I will attach the blog link to this blog after publication.</p><blockquote>Congratulations..! Now it’s time to deploy your own application. Good Luck!</blockquote><blockquote>Let’s meet in another blog. See you guys. Bye!</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6833a6ec0921" width="1" height="1" alt=""><hr><p><a href="https://medium.com/ms-club-of-sliit/deploy-a-nodejs-application-on-azure-app-service-using-acr-6833a6ec0921">Deploying a nodeJS Application on Azure App Service using ACR</a> was originally published in <a href="https://medium.com/ms-club-of-sliit">MS Club of SLIIT</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding Full Stack Web Application Development with applying engineering principles and…]]></title>
            <link>https://medium.com/@isurupathumherath/understanding-full-stack-web-application-development-with-applying-engineering-principles-and-6ea1f02a44ec?source=rss-49138dcfbf31------2</link>
            <guid isPermaLink="false">https://medium.com/p/6ea1f02a44ec</guid>
            <category><![CDATA[full-stack]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[principles]]></category>
            <category><![CDATA[practice]]></category>
            <category><![CDATA[devops]]></category>
            <dc:creator><![CDATA[Isuru Pathum Herath]]></dc:creator>
            <pubDate>Fri, 25 Feb 2022 20:03:10 GMT</pubDate>
            <atom:updated>2022-02-26T12:02:22.937Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AdtI231ndEk3kBAJP2wbTQ.png" /></figure><h3>Understanding Full Stack Web Application Development with applying engineering principles and practices.</h3><p>Hi..! I’m Isuru Pathum Herath. In this blog, let’s see what is full-stack and what are engineering principles and practices we can apply.</p><h4>What you will learn</h4><ol><li>What is full-stack web application development?</li><li>Technologies and tools used in full-stack web development.</li><li>Engineering principals and practices.</li></ol><p><em>Now it’s time to start our tour to explore the above-mentioned areas…!</em></p><h4>1. What is full-stack application development?</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/650/0*WOuG8q8IOeVFQqCv.png" /><figcaption>full-stack web development</figcaption></figure><p>Before understanding what is full-stack, let’s see what are front-end development and back-end development. These are the most popular terms in web application development.</p><p><strong>Frontend development</strong> is <strong><em>developing the UI</em></strong> that interacts with the end-user. The User Interface(UI) must be satisfied with User Experiences(UX). The frontend development is also the main task of developing a web application. The UI must be well planned and well developed before deployment in the production environment. Because the end-user can be a person who just only has basic knowledge about computers. The UI must be easy to use and easy to understand for any kind of user that interacts with the production environment. Otherwise, the application may be useless because the end-user won’t be able to use the system easily, then as a result users won’t like the application and the application would be left by the users. The developers who develop the frontend are called <strong>frontend developers</strong>.</p><p><strong>Backend development</strong> is <strong><em>developing the server-side</em></strong> of the application. We know what is happening in the frontend development now. But it is not enough to have only the best for the application that we are developing. All functionalities must be performed as expected without slowing and interrupting the productivity of the application. The <strong>backend developer</strong> is also has a responsibility of the product quality same as the frontend developers.</p><blockquote>Now you understand what is backend development and frontend development. So What is full-stack development?</blockquote><p><strong>Full-stack development</strong> is referred to the development of <strong><em>both the frontend and backend of a web application</em></strong>.</p><p>A <strong>full-stack web developer can design a full web application and website</strong> including both frontend and backend. They are working on designing and implementing the client-side (frontend) and also designing, implementing, debugging, and maintaining the server-side (backend) with interacting with the databases and other related tools.</p><p><em>Cool..! Now you know what is full-stack web development. I know now you are waiting to know what are technologies and tools full-stack developers are using today. It’s time to go forward to look at them..!</em></p><h4>2. Technologies and tools used in full-stack web development</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*v-fLBqiVjGO3GYoX.png" /><figcaption>Technologies Now Using</figcaption></figure><p>The frontend and backend have different technologies to apply for a product that contains the best quality. Let’s see what are the technologies that used for <strong>full-stack web development</strong>.</p><p>There are so many programming languages and related technologies for front-end development. Such as HTML, CSS, Bootstrap, Javascript, ES5, HTML DOM, JSON, XML, jQuery, AngularJS, React, Redux, GraphQl, Gulp, Grunt, Backbone.js, Ember.js, Typescript. These mentioned languages are commonly used for design, implementation, and styling the frontend according to the UX/UI designing patterns.</p><p>Same as for the frontend development, there are different programming languages and technologies that are used for backend development. Such as PHP, ASP, C++, C#, Java, Python, SQL, Go, REST, Ruby, Node.js, Express.js, MongoDB, Sass, Less, Firebase.com, Parse.com, PaaS (Heroku, Azure, Oracle, and AWS)</p><p>Now let’s discuss the purposes and other details about the above-mentioned languages and technologies.</p><h4><strong>Frontend Development</strong></h4><p><strong>HTML</strong></p><p>This name is a short form of <strong>H</strong>yper <strong>T</strong>ext <strong>M</strong>arkup <strong>L</strong>anguage. This is the standard markup language to implement web pages. The HTML elements are working as the building blocks of a web page.</p><p><strong>CSS</strong></p><p>CSS is coming with <strong>C</strong>ascading <strong>S</strong>tyle <strong>S</strong>heets. This is used for the styling purpose of the designed web pages using HTML.</p><p><strong>Bootstrap</strong></p><p>This is the most popular CSS framework to develop responsive web applications. The developer can design the web page to be responsive for Desktop, Tables, and mobile devices according to their screen size. It is customizable and easy to use.</p><p><strong>JavaScript</strong></p><p>HTML and CSS can only be used to design the webpages. But they are not programming languages. They cannot even define variables. So as the solution “JavaScript” is the programming language for web pages. This can calculate, manipulate and validate data.</p><p><strong>ES5</strong></p><p>EX5 is the short form, of ECMAScript 5. This is known as JavaScript 5 also. This is the 5th edition. Now the ES6, ES7 are to use as developed editions.</p><p><strong>HTML DOM</strong></p><p>This is an Object Model for HTML. This defines HTML elements as objects and properties, methods, events for all elements. HTML DOM is an AI for JavaScript.</p><p><strong>JSON</strong></p><p>This is the short form of JavaScrip Object Notation. JSON is a lightweight format for storing and transporting data on a web page. JSON is self-describing and easy to use and understand. This is used to send data from a server to a web page.</p><p><strong>XML</strong></p><p>XML is the eXtendable Markup Language that is used for distributing data over the internet. Therefore XML is an important role in many different IT systems. It is very useful for a web developer to understand XML.</p><p><strong>jQuery</strong></p><p>This is a JavaScrip library that simplifies JavaScrip programs well. This is easy to learn and easy to use.</p><p><strong>AngularJS</strong></p><p>Angular can extend HTML with HTML attributes called directives. This offers functionality to HTML-based applications. The important thing is Angular provides both built-in directives and user-defined directives. It lets you use HTML as your template language. AngularJS is a <strong>structural framework for dynamic web apps</strong>.</p><p><strong>React</strong></p><p>React is a JavaScript library created by the Facebook company. This allows you to create a web UI using HTML, CSS, DOM, ES6, Node.js, and npm. React is for building User Interfaces. Therefore this is called a UI library. This helps you to build UI components.</p><p><strong>Redux</strong></p><p>Redux can be used <strong>as a data store for any UI layer</strong>. Although React and React Native are the most popular, bindings for Angular, Angular 2, Vue, Mithril, and other frameworks are also available. Redux merely offers a subscription mechanism that any other programs may utilize.</p><p><strong>GraphQL</strong></p><p>GraphQL was created to make APIs that are quick, versatile, and developer-friendly. It may even be used within the GraphiQL integrated development environment (IDE). GraphQL, a REST alternative, allows developers to create queries that pull data from various sources in a single API call.</p><p><strong>Gulp</strong></p><p>Gulp is a streaming task runner that allows developers to automate a variety of development processes. Gulp reads files as streams and pipes them to different jobs at a high level. These jobs are based on code and rely on plugins.</p><p><strong>Grunt</strong></p><p>Grunt employs the utilization of temporary files. Gulp makes use of Node streams. Grunt completes jobs one at a time. Gulp juggles many jobs at the same time.</p><p><strong>Backbone.js</strong></p><p>BackboneJS is a lightweight JavaScript toolkit that allows you to create and organize web-based client-side applications. It includes an MVC framework that abstracts data into models, DOM into views, and binds the two together with events.</p><p><strong>Ember.js</strong></p><p>Ember is a front-end framework alone. It includes several ways to interface with the backend of your choosing, but Ember does not handle this backend in any manner.</p><p><strong>Typescript</strong></p><p>TypeScript may be used to create both client-side and server-side JavaScript applications (as with Node. js or Deno). Transcompilation can be done in a variety of ways. To convert TypeScript to JavaScript, you may use either the default TypeScript Checker or the Babel compiler.</p><h4>Backend Development</h4><p><strong>PHP</strong></p><p>PHP is a server-side scripting language that may be used to create dynamic, interactive Web sites. PHP is a popular, free, and efficient alternative to competitors like Microsoft’s Active Server Pages (ASP).</p><p><strong>ASP</strong></p><p>ASP stands for <strong>A</strong>ctive <strong>S</strong>erver <strong>P</strong>ages ASP is a development framework for building web pages. There are many different development models such as Classic ASP, ASP.NET Web Forms, ASP.NET MVC, ASP.NET Web Pages, ASP.NET API and ASP.NET Core. ASP and ASP.NET are server-side programming languages. Both approaches allow an Internet server to run computer code. When a browser requests an ASP or ASP.NET file, the ASP engine examines the file, runs any code included inside it, and provides the output to the browser.</p><p><strong>C++</strong></p><p>C++ is a popular programming language that is used to create computer programs and backends of web application development.</p><p><strong>C#</strong></p><p>C# (C-Sharp) is a Microsoft programming language that runs on the.NET Framework and can be used to create online apps, desktop apps, mobile apps, games, and much more.</p><p><strong>Java</strong></p><p>The programming language Java is widely used. Java is a programming language that is used to create mobile apps, web apps, desktop apps, games, and much more.</p><p><strong>Python</strong></p><p>Python is used on the server-side to create web applications. Not only that, <br>This language is commonly used to create websites and applications, automate operations, and do data analysis. Python is a general-purpose programming language, which means it can be used to develop a wide range of applications and isn’t specialized for any particular problem.</p><p><strong>SQL</strong></p><p>SQL is a language for interacting with databases. It is the standard language for relational database management systems, according to ANSI (American National Standards Institute). SQL statements are used to conduct operations like updating data in a database and retrieving data from one.</p><p><strong>Go</strong></p><p>Go (also known as Golang or Go language) is an open-source general-purpose computer language. Google developers created Go to construct stable and efficient software. Go is statically typed and explicit, and is most closely modeled after C.</p><p><strong>REST</strong></p><p>A REST API (also known as a RESTful API) is a type of application programming interface (API or web API) that adheres to the REST architectural style’s limitations and allows interaction with RESTful web services. Roy Fielding, a computer scientist, invented REST, which stands for representational state transfer.</p><p><strong>Ruby</strong></p><p>Ruby is a general-purpose programming language that may be used for a variety of tasks. Ruby is an excellent language for creating desktop programs, static webpages, data processing services, and even automation solutions. Web servers, DevOps, and web scraping and crawling are all examples of where it’s employed.</p><p><strong>Node.js</strong></p><p>Because of its single-threaded nature, Node. js is best suited for non-blocking, event-driven servers. It was created with real-time, push-based architectures in mind and is utilized for standard web pages and back-end API applications.</p><p><strong>Express.js</strong></p><p>Express. js is a Node. js web application framework that is free and open-source. It is used to rapidly and simply design and create web apps.</p><p><strong>MongoDB</strong></p><p>MongoDB is a NoSQL database management system that is free and open source. Working with massive quantities of dispersed data is a breeze with NoSQL databases. MongoDB is a database management system that can store and retrieve document-oriented data.</p><p><strong>Sass</strong></p><p>Sass is a CSS pre-processor. This reduces the repetition of CSS and therefore saves time.</p><p><strong>Less</strong></p><p>You may conduct specific mathematical operations within the codes with the <strong>Less CSS</strong> preprocessor to extract desired values using multiplication, division, addition, and subtraction. These arithmetic procedures may be used to colors and variables in addition to integers.</p><p><strong>Firebase.com</strong></p><p>Google Firebase is a Google-backed app development platform that allows developers to create apps for iOS, Android, and the web. Firebase delivers analytics monitoring, reporting, and app issue fixes, as well as marketing and product experimentation capabilities.</p><p><strong>PaaS</strong></p><p>PaaS is a full cloud development and deployment environment with resources that enable you to produce everything from simple cloud-based apps to sophisticated, cloud-enabled business systems.</p><p><em>Before moving on to the next level, let me show you the most popular frontend and backend development tools and languages today used.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*DYoc7Bz5t6W929r7.gif" /><figcaption>Source — <a href="https://www.mobindustry.net/">https://www.mobindustry.net/</a></figcaption></figure><blockquote>Now you understand what are the purposes of different technologies and different programming languages used in full-stack development. So as the next step, let’s see what are the engineering principals and best practices of full-stack web development.</blockquote><h4>3. Engineering principals and practices</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Dblcc6dZ8R9vkraI.jpg" /></figure><blockquote>Here we are going to discuss what is SOLID Principle is and understand the purpose of using it.</blockquote><h4>What is the SOLID Principle?</h4><p>SOLID can be applied in various programming languages. So here let’s assume we are talking about full-stack web development.</p><p>SOLID principles are introduced by <strong>Robert C.Martine that also known as Uncle Bob</strong>.</p><p>These principles outline best practices for designing software while keeping in mind the project’s long-term maintenance and expansion. Adopting these techniques can also help you avoid code smells, restructure your code, and design Agile or adaptive software.</p><p><em>So here are whatSOLID stands for</em></p><ul><li><strong>S</strong> — Single-responsibility Principle</li><li><strong>O</strong> — Open-closed Principle</li><li><strong>L</strong> — Liskov Substitution Principle</li><li><strong>I</strong> — Interface Segregation Principle</li><li><strong>D</strong> — Dependency Inversion Principle</li></ul><p>Now let’s look at them one by one to have a brief idea.</p><p><strong>Single-responsibility Principle</strong></p><p>Single-responsibility Principle (SRP) states:</p><p><em>“A class should have one and only one reason to change, meaning that a class should have only one job.”</em></p><p>Each function you write should only do one task. It should have a single, well-defined objective. You’ll be shocked how many times you wish your function could perform more than “one thing.” You’ll also have trouble articulating what the “one thing” you want to accomplish is regularly.</p><p><strong>Open-closed Principle</strong></p><p>The open-closed Principle (OCP) states:</p><p><em>“Objects or entities should be open for extension but closed for modification.”</em></p><p>This means that a class should be able to be extended without requiring changes to the class itself.</p><p>The Open-Closed Principle states that our JavaScript modules should be extensible but not modifiable. That is, if someone wants to increase the functionality of our module, they won’t have to alter the current code if they don’t want to. You may use a simple rule of thumb to help you out here. You’ve failed the open-closed principle if I have to access your module’s JS file and perform a modification to expand it.</p><p><strong>Liskov Substitution Principle</strong></p><p>Liskov Substitution Principle states:</p><p><em>“Let q(x) be a property provable about objects of x of type T. Then q(y) should be provable for objects y of type S where S is a subtype of T.”</em></p><p>Every subclass or derived class should be interchangeable with its base or parent class.</p><p>I found this example from StackOverflow. I would like to share it with you in this blog.</p><blockquote>A wonderful example of LSP (provided by Uncle Bob in a recent podcast I listened to) was how something that seems fine in normal language doesn’t always work in code.</blockquote><blockquote>A Rectangle is a Square in mathematics. It is, in fact, a rectangle’s specialty. The “is a” makes you want to use inheritance to model this. However, if you make Square inherit from Rectangle in code, then a Square should be used anyplace a Rectangle is expected. This results in some unusual behaviors.</blockquote><blockquote>Imagine your Rectangle base class included SetWidth and SetHeight methods; this looks totally sensible. SetWidth and SetHeight don’t make sense if your Rectangle reference is a Square, because adjusting one would modify the other to match it.</blockquote><blockquote>Square fails the Liskov Substitution Test with Rectangle in this scenario, because inheriting from Rectangle is a faulty abstraction.</blockquote><p><strong>Interface Segregation Principle</strong></p><p>Interface segregation principle states:</p><p><em>“A client should never be forced to implement an interface that it doesn’t use, or clients shouldn’t be forced to depend on methods they do not use.”</em></p><p>The term “interface segregation” really refers to the practice of not creating bloated user interfaces. Because JavaScript lacks interfaces.</p><p><strong>Dependency Inversion Principle</strong></p><p>The dependency inversion principle states:</p><p><em>“Entities must depend on abstractions, not on concretions. It states that the high-level module must not depend on the low-level module, but should depend on abstractions.”</em></p><p>You may have heard of dependency inversion previously but under a different name. The terms Dependency Injection and Inversion of Controls are interchangeable. This is the most well-known of the principles.</p><p>Dependency Injection is all about transferring control from the function to the function’s caller. It’s specifying who has control over the type of parameters the function gets in our scenario.</p><p><strong><em>Here I wanted to give you a brief idea about these principles without going so far. Now I think you know what is SOLID and how they are working.</em></strong></p><p><strong><em>Before the move to talk about practices, I think it is better to discuss how we can approach solutions for a business problem.</em></strong></p><h4>Approaching the solution</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*0jfHW4S75e4qtCPu.png" /></figure><p>Software engineering refers to the use of systematic engineering principles in the creation of software products and applications. It is a discipline of engineering concerned with assessing user requirements, software design, development, testing, and maintenance.</p><p>In software engineering every time we have to solve business problems. They might be a solution that depends on the whole product quality and functionalities. Always we must find the best technical solution to solve the problem.</p><p>I am going to show you the steps we can use to do it easily without taking too much time to get the best solution.</p><ol><li>Think throughout the problem</li><li>Divide and Conquer</li><li>KISS</li><li>Learn, especially from mistakes</li><li>Always remember why software exists</li><li>Remember that you are not the user</li></ol><p>Let’s go through with one by one.</p><p><strong>Think throughout the problem</strong></p><p>First, we must think about the problem on every side that we can apply a solution. It is like designing the software solution in mind. Mainly understand the real problem before applying the solution. Otherwise, your effort may be wasted after identifying the real problem when you be quick before identifying the real issue. Maybe this may get some time, but this is the best way to enter to resolve the problem that you have to implement the solution. You can note and think and design the steps that you are going through. Then it would be so easy to apply without understanding. Make sure to ask questions and clarify any kind of part that you are not clear with.</p><p><strong>Divide and Conquer</strong></p><p>Divide your problem into small pieces. It is easy to eat small pieces that eat the whole pizza a once. So you understand that, make sure to divide and clear every single part. This may help you to understand the problem easily without time waste.</p><p><strong>KISS</strong></p><p>We all love each other. But this kiss is about to <em>KEEP IT SIMPLE AND STUPID</em>. What it means is, don’t be stressed with the problem but don’t think you know everything as much to solve the problem easily. You must be in the middle of both. Otherwise, it may be a problem to solve the real problem.</p><p><strong>Learn, especially from mistakes</strong></p><p>Accept the modification. Always try to anticipate as many changes as possible. Don’t overengineer it, but leave room for expansion. Learn from the mistake that you have done before. They are called experiences that we can develop well. The experience is the building block of a well-developed software engineer. Don’t put your experience in the bin. Take them out! and look at them. Learn what you missed and don’t keep repeating them.</p><p><strong>Always remember why software exists</strong></p><p>You must have a clear idea about the product that you are implementing. And the audience that going to use. Why this software for? and that is the actual solution’s starting point.</p><p><strong>Remember that you are not the user</strong></p><p>Keep it in your mind! You are not the end-user. The user might not have much idea about computer systems, but your system must be familiar with them without making them stressed. Keep it simple and make them happy.</p><blockquote>Cool..! Here you got the idea of approaching a solution for business problems as a software engineer.</blockquote><p>Let’s see what are practices we can apply in our software product.</p><h4>Practices</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/860/0*mzIVVyZN2Doevblk" /></figure><p>Practices make it easy to deliver a quality product in time with all the functionalities. Here I am going to tell some of the best practices used in the industry.</p><p><strong>Unit Testing</strong></p><p>Unit testing is a software development technique in which the smallest testable pieces of a program, referred to as units are examined separately and independently for correct functioning. Software developers and, on occasion, QA employees use this testing approach during the development process.</p><p>There are several unit testing tools are using in the industry.</p><ul><li>Junit</li><li>NUnit</li><li>JMockit</li><li>EMMA</li><li>PHPUnit</li></ul><p><strong>Code Quality</strong></p><p>Code quality distinguishes between good (high quality) and bad (low quality) code (low quality). Quality, good, and terrible is all subjective terms. Depending on the situation, various teams may employ different meanings. For an automobile developer, high-quality code might imply several things.</p><p><strong>Code Review</strong></p><p>The act of actively and methodically gathering with one’s fellow programmers to review each other’s code for problems, also known as Peer Code Review, has been proved to speed and streamline the process of software development as few other methods can.</p><p><strong>Version Controlling</strong></p><p>The method of recording and controlling changes to software code is known as version control, sometimes known as source control. Version control systems (VCS) are software tools that aid software development teams in managing source code change over time.</p><p>Here are some tools used for version control.</p><ul><li>GitHub</li><li>GitLab</li><li>Beanstalk</li><li>PerForce</li><li>Apache Subversion</li><li>AWS CodeCommit</li><li>Oracle Developer Cloud Service</li></ul><p><strong>Continuous Integration</strong></p><p>Continuous integration is a DevOps software development approach in which developers integrate their code changes into a common repository on a frequent basis, followed by automated builds and testing.</p><p>Here are some examples of CI tools.</p><ul><li>Jenkins</li><li>TeamCity</li><li>Bamboo</li><li>Buddy</li><li>GitLab CI</li><li>CircleCI</li><li>TravisCI</li></ul><p>And please <a href="https://medium.com/ms-club-of-sliit/deploy-a-nodejs-application-in-heroku-using-wercker-pipeline-github-704ae42cc86f">read this blog written by me to understand the real approach of DevOps and CI/CD pipelines</a>.</p><p>You can also read this blog about <a href="https://medium.com/@isurupathumherath/deploy-a-nodejs-application-on-azure-app-service-using-acr-6833a6ec0921">Deploying a nodeJS Application on Azure App Service using ACR</a>.</p><p>Nice..! This is the end of this blog. I think you learn something new from this. Good Luck! Let’s meet in the next blog.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6ea1f02a44ec" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Deploy a NodeJS Application in Heroku using Wercker Pipeline & GitHub]]></title>
            <link>https://medium.com/ms-club-of-sliit/deploy-a-nodejs-application-in-heroku-using-wercker-pipeline-github-704ae42cc86f?source=rss-49138dcfbf31------2</link>
            <guid isPermaLink="false">https://medium.com/p/704ae42cc86f</guid>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[github]]></category>
            <category><![CDATA[heroku]]></category>
            <category><![CDATA[git]]></category>
            <category><![CDATA[wercker]]></category>
            <dc:creator><![CDATA[Isuru Pathum Herath]]></dc:creator>
            <pubDate>Fri, 04 Feb 2022 01:13:39 GMT</pubDate>
            <atom:updated>2022-02-04T10:26:11.548Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*b5Zf-AmONYTyESP1fLl4Yg.png" /></figure><p>Upload the code to GitHub Repository and trigger a Wercker pipeline automatically. Deploy the app in Heroku.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*byvUr3b83cEDlOOagciH1w.png" /></figure><p>In application development, DevOps is extremely crucial. Every company that uses DevOps in its projects. Developer and operations work is made easier using DevOps. We will utilize Git as a version control system in DevOps. Jenkins was used to compile the code in Git.</p><p>In this blog, you will learn how to create a GitHub repository, create a Wercker pipeline to deploy a nodeJS (MERN) application on Heroku.</p><h3><strong><em>What you will learn</em></strong></h3><ol><li>Create a GitHub Repository.</li><li>Push your code to GitHub Repository from the local machine.</li><li>Create a Wercker pipeline</li><li>Deploy a NodeJS (MERN) App in Heroku</li></ol><p><em>Now it’s time to go to the tutorial.</em></p><h3><strong>1. Create a GitHub Repository</strong></h3><p>GitHub is a version control and collaboration tool for programming. It allows you and others to collaborate on projects from any location. This course covers the fundamentals of GitHub, such as repositories, branches, commits, and pull requests.</p><p>We are going to use a GitHub repository and trigger a Wercker pipeline when you commit a code into the repository.</p><p>Let’s create a repository first.</p><p>1. Go to <a href="https://github.com/">GitHub</a> and create an account if you don’t have one or you can log in to the GitHub account.</p><p>2. Then click on the <strong><em>profile icon on the top right corner</em></strong> of the GitHub page. And click <strong><em>Your Repositories</em></strong>.</p><figure><img alt="Go to Repository" src="https://cdn-images-1.medium.com/max/1024/1*ndDRoQ_W3g-eWXZAwuvFmg.png" /><figcaption>Navigate to repository</figcaption></figure><blockquote>Now you can see your all repositories that currently have or maybe there is no repository if you are new to GitHub. No worries..! Let’s create a new one now.</blockquote><p>3. Click on the <strong><em>New</em></strong> button. Then you will be redirected to the repository-creating page.</p><figure><img alt="Create a new Repository" src="https://cdn-images-1.medium.com/max/1024/1*g_vX9j0lWDiok7qp1cVqpw.png" /><figcaption>Create new repository</figcaption></figure><blockquote>Here you can give a repository name, description, select private or public, and create the repository.</blockquote><figure><img alt="Create a new Repository" src="https://cdn-images-1.medium.com/max/784/1*sk01ldJ4izfgzoe6vJNjuQ.png" /><figcaption>Create new repository</figcaption></figure><p>Click <strong><em>Create repository</em></strong>.</p><blockquote>Now you can see the repository you created.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DqumeDRxbgsV6giUlQb47A.png" /><figcaption>GitHub Repository</figcaption></figure><p>Cool…!</p><p>You have created your repository. Now let’s see how to push our code into this GitHub repository from our local machine. I use my own created project to continue with this tutorial.</p><h3>2. Push your code to GitHub Repository</h3><p>You can use the command mentioned in the GitHub repository page after creating the repository. However, I am going to mention all these commands in this step.</p><p>1. Go to the folder your code is stored in your local machine.</p><p>2. Right-click and open <a href="https://git-scm.com/downloads"><strong><em>git bash</em></strong></a><strong><em> </em></strong>and use the below commands one by one. (Install<a href="https://git-scm.com/downloads"> git bash</a> if you are not installed in your machine)</p><pre>git init</pre><pre>git add .</pre><pre>git commit -m &quot;first commit&quot;</pre><pre>git branch -M main</pre><pre>git remote add origin &lt;Your Repository HTTPS URL&gt;</pre><pre>git push -u origin main</pre><p>Wooo..!</p><p>Now it’s done. Go to your GitHub repository and refresh the page. Your whole code is there!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UBaGek6nyuc-7-_gQq-M8A.png" /><figcaption>GitHub Repository</figcaption></figure><p>Now it’s time to go to create a Wercker pipeline.</p><h3>3. Create an Application in Wercker</h3><p>Wercker is <strong>a Docker-based continuous delivery platform that helps software developers build and deploy their applications and microservices</strong>. The business behind Wercker, also called Wercker, was founded in 2012 and acquired by Oracle Corporation in 2017. (<a href="https://en.wikipedia.org/wiki/Wercker">Wikipedia</a>)</p><p>1. <strong>Go to </strong><a href="https://app.wercker.com/"><strong>https://app.wercker.com/</strong></a></p><p>2. <strong>Create an account</strong> if you don’t have an account or <strong>log in to the Wercker</strong>.</p><p><em>So now you need to create an application first.</em></p><p>3. <strong>Click on the plus (+) sign on the top right corner</strong> of the Wercker page.</p><figure><img alt="Create an application" src="https://cdn-images-1.medium.com/max/1024/1*VFZE4Rc6GswKmf7r1DdGcQ.png" /></figure><p><em>You are able to see select </em><strong><em>Add Application</em></strong><em>. Click on it.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/382/1*84ByafpV1ccQzDEVKLAhnQ.png" /><figcaption>Add Application</figcaption></figure><p>4. Select <strong>GitHub </strong>and Click <strong>Next</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Q3cUE1JHS4bneU23qd6m6Q.png" /><figcaption>Select SCM</figcaption></figure><blockquote>NOTE: You have to log in to the GitHub account after clicking next.</blockquote><p>5. Now you can <strong>select the repository you were created</strong> before and <strong>click next</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VsO9NyarSkHMahUUN6Ivow.png" /><figcaption>Select Repository</figcaption></figure><p>6. Now <strong>click the recommended option</strong> and <strong>click next</strong> again.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*c-mHXrqs6MdtB5vBdvH6OQ.png" /><figcaption>Setup SSH Key</figcaption></figure><p>7. In the last step. You can <strong>confirm your details</strong> and <strong>Create</strong> the application.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4cVCcSdAPkMOyWnW6zODqA.png" /><figcaption>Confirm and Create</figcaption></figure><p>Nice ….!</p><blockquote>Your Wercker application is ready to continue working with you. You will see your application in the following image.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Tfxn0QQl3katMHBmi5oEow.png" /><figcaption>Wercker Application</figcaption></figure><p>Before creating the Wercker pipeline, let’s create an application in Heroku to continue our tutorial.</p><h3>4. Create an Application in Heroku</h3><p><strong>Heroku</strong> is a platform as a service (PaaS) that enables developers to build, run, and operate applications entirely in the cloud.</p><p>1. First <strong>login </strong>to your <a href="https://dashboard.heroku.com/login">Heroku</a> account or <strong>create an account</strong>.</p><p>2. Click on the <strong>New</strong> button.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5Yxp7ey4CmrN6GPKWkWjBQ.png" /><figcaption>Click New</figcaption></figure><p>3. Select <strong>Create new app</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/289/1*3ruUY9llSlOAMU3JPpWyIw.png" /><figcaption>Create New App</figcaption></figure><p>4. Now you can give a name to your app and select a region. After giving your details <strong>Click Create app.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/989/1*-LejmOrS7fnVenyaSITlgA.png" /><figcaption>Create Heroku App</figcaption></figure><blockquote>Now your application has been created in Heroku.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Qleq4XnyARDCxmhKzn1JVQ.png" /><figcaption>Heroku App Dashboard</figcaption></figure><blockquote>Now again let’s move to Wercker. In the created application, now we can create our pipeline.</blockquote><h3>5. Create the Wercker Pipeline</h3><p>To create a Wercker pipeline, we need to use a wercker.yml file. If you need more information, you can refer to the <a href="https://devcenter.wercker.com/development/pipelines/">official document</a>.</p><p>First, let’s build the nodeJS application. We need a wercker.yml file as I mentioned earlier. Go to your local repository in your local machine and create a file named “wercker.yml”.</p><p><strong>Use this code to build the application.</strong></p><pre>box: node<br>build:  <br>  steps:    <br>    - npm-install    <br>    - script:        <br>        name: echo nodejs information        <br>        code: |          <br>            echo &quot;node version $(node -v) running&quot;          <br>            echo &quot;npm version $(npm -v) running&quot;</pre><p>This is one pipeline. The name of the pipeline is “build”. Using this we can run the command “npm install” and print the node version and npm version we used. The image we are using is “node”.</p><p>Not save and commit and push this code to GitHub Repository. You will see the Wercker pipeline is started to run automatically because it has been already created the pipeline named “build”.</p><p><strong><em>Click on Workflows</em></strong> to see the pipeline.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jNhlBi_mQa3hGKRuUnh1DQ.png" /><figcaption>Current Pipelines</figcaption></figure><p>Use the following command to push the local repository to the GitHub repository.</p><pre>git add .</pre><pre>git commit -m &quot;build the app&quot;</pre><pre>git push</pre><p>After pushing the code. You can see the pipeline has been started.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GY05SYXvmlNur-bE1JMKAw.png" /><figcaption>Pipeline “build” triggered</figcaption></figure><p>Cooooool…!</p><p>Now let’s see how to deploy the app in Heroku using a pipeline. Attach the following code segment to the “wercker.yml” file and save.</p><pre>deploy:  <br>  steps:    <br>    - heroku-deploy:        <br>        key: $HEROKU_KEY        <br>        user: $HEROKU_USER        <br>        app-name: $HEROKU_APP_NAME</pre><p>Before pushing the code to GitHub, we must create the next pipeline named “heroku-deploy” and specify variables inside the pipeline.</p><p>The final “wercker.yml” file should contain these code segments.</p><pre>box: node<br>build:  <br>  steps:    <br>    - npm-install    <br>    - script:        <br>        name: echo nodejs information        <br>        code: |          <br>            echo &quot;node version $(node -v) running&quot;          <br>            echo &quot;npm version $(npm -v) running&quot;<br>deploy:  <br>  steps:    <br>    - heroku-deploy:        <br>        key: $HEROKU_KEY        <br>        user: $HEROKU_USER        <br>        app-name: $HEROKU_APP_NAME</pre><p>1. Go to <strong><em>Workflows </em></strong>and<em> click </em><strong><em>add new pipeline.</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*38S9qmguC2tbsxwn7Uxqgw.png" /><figcaption>Add new pipeline</figcaption></figure><p>2. Name the pipeline as “heroku-deploy” and click on Create. Make sure to select the Hook type as “Default”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LdljVtG6hkJpLwMaiOvcag.png" /><figcaption>Create new Pipeline</figcaption></figure><p>Now our next pipeline has been created. But here we must specify some variables mentioned in the “wercker.yml” file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/314/1*AYmgHvAYjEmjog6n2k4Fhg.png" /></figure><p>Let’s find these values.</p><p><strong>HEROKU_KEY</strong></p><p>1. Go to Heroku</p><p>2. Click Profile Icon</p><p>3. Go to Account Settings</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9qcbCKuQzPXgbv5sv0kbpw.png" /><figcaption>Navigate tp profile and Select Account Settings</figcaption></figure><p>4. In the account Tab, Scroll down and find API Key. Click Reveal</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/419/1*b3uOpfI2CaR9mBT8c028ag.png" /><figcaption>Navigate to Account</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kAPN-CL_6h4-hFHdGJCECw.png" /><figcaption>API Key — Heroku</figcaption></figure><p>Copy the API key and paste it into the Wercker pipeline we created now.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xhwDRPpie1pLsHOMrxwqmw.png" /><figcaption>Add HEROKU_KEY</figcaption></figure><p><strong>HEROKU_USER</strong></p><p>Heroku user is the user email address used to create the Heroku account.</p><p>Add it into the Wercker pipeline same as before.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UMMTZfMy2WuoReKtAfYDZw.png" /><figcaption>Add HEROKU_USER</figcaption></figure><p><strong>HEROKU_APP_NAME</strong></p><p>This is the app name of the app we created in Heroku.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/404/1*dhVjtqJD8eNxKTbCdGYxaQ.png" /><figcaption>Heroku App Name</figcaption></figure><p>Now you know what you must do. Yes! Add it in the pipeline variables.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*J_D4RiopYmF3segydZ6_ZQ.png" /><figcaption>Add HEROKU_APP_NAME</figcaption></figure><p>Now it is done. But there is another step.</p><p>Add the pipeline sequence in Editor.</p><ol><li>Go to <strong><em>Workflows.</em></strong></li><li>Click on the plus button in the Editor area and select the pipeline you just created.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KRddywuiC7fkI1gnqd8m9Q.png" /><figcaption>Click the + Button</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/413/1*fRWb009lYx-mVjWjVNxstg.png" /><figcaption>Click the pipeline and Add</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/847/1*vaW7GRe7rU8BkJBOP4FrPA.png" /><figcaption>Added Pipeline</figcaption></figure><blockquote>Now all ready to go. Push your code to GitHub repository. Yeah…! The pipeline triggers and deploy it in Heroku Automatically.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*II06r4XcPnHc35qhilzI0A.png" /><figcaption>Wercker Pipelines — Heroku Deploy</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Xbmb51GmCa0Z9PFK6y81dw.png" /><figcaption>Heroku Build</figcaption></figure><blockquote><strong>App has been successfully deployed in Heroku.</strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*J_-qI0MbpTaEHQ8gBgBKJQ.png" /><figcaption>Success Pipeline</figcaption></figure><blockquote><strong>Now you can access the application by clicking “Open app” in Heroku.</strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rwB2FbPE_DVgwTpntSvRIA.png" /><figcaption>Sample App has Deployed</figcaption></figure><p>Congratulations…!</p><p>Now you are ready to work with Wercker pipelines. You can refer to more details in the <a href="https://devcenter.wercker.com/overview-and-core-concepts/">official document</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=704ae42cc86f" width="1" height="1" alt=""><hr><p><a href="https://medium.com/ms-club-of-sliit/deploy-a-nodejs-application-in-heroku-using-wercker-pipeline-github-704ae42cc86f">Deploy a NodeJS Application in Heroku using Wercker Pipeline &amp; GitHub</a> was originally published in <a href="https://medium.com/ms-club-of-sliit">MS Club of SLIIT</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>