<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Samira Awad</title>
    <description>The latest articles on DEV Community by Samira Awad (@samirabawad).</description>
    <link>https://dev.to/samirabawad</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1841756%2Ffef35401-1325-4918-be84-cfdda492ebbd.jpeg</url>
      <title>DEV Community: Samira Awad</title>
      <link>https://dev.to/samirabawad</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/samirabawad"/>
    <language>en</language>
    <item>
      <title>How to Deploy ASP.NET Applications on IIS: Complete Guide</title>
      <dc:creator>Samira Awad</dc:creator>
      <pubDate>Sun, 23 Mar 2025 19:43:26 +0000</pubDate>
      <link>https://dev.to/samirabawad/how-to-deploy-aspnet-applications-on-iis-complete-guide-502h</link>
      <guid>https://dev.to/samirabawad/how-to-deploy-aspnet-applications-on-iis-complete-guide-502h</guid>
      <description>&lt;p&gt;Deploying ASP.NET applications on IIS is an essential task for developers working in Windows environments. In this tutorial, I'll guide you step-by-step on how to deploy both ASP.NET Framework and ASP.NET Core applications on IIS, including setting up custom domains, SSL certificates, and more.&lt;/p&gt;




&lt;h2&gt;
  
  
  Prerequisites
&lt;/h2&gt;

&lt;p&gt;Before starting, make sure you have the following:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;IIS installed on your server or local machine.&lt;/li&gt;
&lt;li&gt;Published ASP.NET application (either .NET Framework or .NET Core).&lt;/li&gt;
&lt;li&gt;A custom domain (optional but recommended for production).&lt;/li&gt;
&lt;li&gt;An SSL certificate (optional but essential for HTTPS).&lt;/li&gt;
&lt;li&gt;Administrator permissions on the server.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Step 1: Install IIS and Required Tools
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1.1 Install IIS
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Open the Control Panel and select &lt;strong&gt;Programs &amp;gt; Turn Windows features on or off&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Look for &lt;strong&gt;Internet Information Services (IIS)&lt;/strong&gt; and check the box to install it.&lt;/li&gt;
&lt;li&gt;Make sure to include the following features:

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;ASP.NET&lt;/strong&gt; (for .NET Framework applications).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;ASP.NET Core Module&lt;/strong&gt; (for .NET Core applications).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;CGI&lt;/strong&gt; (only if you need to run additional applications).&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;




&lt;h3&gt;
  
  
  1.2 Install .NET Runtime (Only for ASP.NET Core)
&lt;/h3&gt;

&lt;p&gt;If your application is ASP.NET Core, you need to install the corresponding runtime:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Download the runtime from the official &lt;a href="https://dotnet.microsoft.com/" rel="noopener noreferrer"&gt;.NET website&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Install the version that matches your application.&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  Step 2: Publish the ASP.NET Application
&lt;/h2&gt;

&lt;h3&gt;
  
  
  2.1 Publish from Visual Studio
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Open your project in Visual Studio.&lt;/li&gt;
&lt;li&gt;Right-click on the project and select &lt;strong&gt;Publish&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Configure the publishing profile:

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Folder&lt;/strong&gt;: Publish to a folder on your server.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;IIS&lt;/strong&gt;: Publish directly to IIS if you have a publishing profile configured.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;




&lt;h3&gt;
  
  
  2.2 Prepare the Published Files
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Copy the published files to a folder on the server (e.g., &lt;code&gt;C:\Applications\MyAppASP&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;Ensure the folder has read and execute permissions for the &lt;code&gt;IIS_IUSRS&lt;/code&gt; user.&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  Step 3: Create a Site in IIS
&lt;/h2&gt;

&lt;h3&gt;
  
  
  3.1 Create the Site
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Open IIS Manager (press &lt;code&gt;Win + R&lt;/code&gt; and type &lt;code&gt;inetmgr&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;Right-click on &lt;strong&gt;Sites&lt;/strong&gt; (left panel) and select &lt;strong&gt;Add Website&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Configure the following:

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Site name&lt;/strong&gt;: A descriptive name (e.g., &lt;code&gt;MyAppASP&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Physical path&lt;/strong&gt;: Select the folder where the published files are located.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Binding&lt;/strong&gt;: Configure the port (80 for HTTP or 443 for HTTPS) and host name (your custom domain, e.g., &lt;code&gt;myapp.com&lt;/code&gt;).&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;




&lt;h3&gt;
  
  
  3.2 Configure Bindings
&lt;/h3&gt;

&lt;p&gt;Bindings are essential to associate a website with an IP address, port, and domain name.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;In IIS Manager, select the site you just created.&lt;/li&gt;
&lt;li&gt;In the right panel, click on &lt;strong&gt;Bindings&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Add a new binding for HTTPS if needed:

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Type&lt;/strong&gt;: &lt;code&gt;https&lt;/code&gt; or &lt;code&gt;http&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Port&lt;/strong&gt;: &lt;code&gt;443&lt;/code&gt; or &lt;code&gt;80&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Host name&lt;/strong&gt;: &lt;code&gt;myapp.com&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;SSL certificate&lt;/strong&gt;: Select your installed certificate.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  Step 4: Configure the ASP.NET Module
&lt;/h2&gt;

&lt;h3&gt;
  
  
  4.1 For .NET Framework Applications
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Ensure ASP.NET is installed in IIS.&lt;/li&gt;
&lt;li&gt;In IIS Manager, select the website.&lt;/li&gt;
&lt;li&gt;In the center panel, double-click on &lt;strong&gt;Modules&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Verify that the &lt;strong&gt;ASP.NET&lt;/strong&gt; module is present and enabled.&lt;/li&gt;
&lt;/ol&gt;




&lt;h3&gt;
  
  
  4.2 For .NET Core Applications
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Ensure the &lt;strong&gt;ASP.NET Core Module&lt;/strong&gt; is installed in IIS.&lt;/li&gt;
&lt;li&gt;In IIS Manager, select the website.&lt;/li&gt;
&lt;li&gt;In the center panel, double-click on &lt;strong&gt;Modules&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Verify that the &lt;strong&gt;ASP.NET Core Module&lt;/strong&gt; is present and enabled.&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  Step 5: Configure the Hosts File (Optional for Local Testing)
&lt;/h2&gt;

&lt;p&gt;If you're testing locally and want to use a custom domain, you need to add an entry to the &lt;code&gt;hosts&lt;/code&gt; file.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Open Notepad as an administrator.&lt;/li&gt;
&lt;li&gt;Go to &lt;strong&gt;File &amp;gt; Open&lt;/strong&gt; and navigate to:
C:\Windows\System32\drivers\etc\hosts&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Copy&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Add a new line at the end of the file with the format:
127.0.0.1 myapp.com&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Copy&lt;br&gt;
(Replace &lt;code&gt;127.0.0.1&lt;/code&gt; with your server's IP if working on a network).&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Save the file.&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  Step 6: Configure Permissions and Security
&lt;/h2&gt;

&lt;h3&gt;
  
  
  6.1 Folder Permissions
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Right-click on the application folder and select &lt;strong&gt;Properties&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Go to the &lt;strong&gt;Security&lt;/strong&gt; tab and add the &lt;code&gt;IIS_IUSRS&lt;/code&gt; user with read and execute permissions.&lt;/li&gt;
&lt;/ol&gt;




&lt;h3&gt;
  
  
  6.2 Authentication in IIS
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;In IIS Manager, select the website.&lt;/li&gt;
&lt;li&gt;In the center panel, double-click on &lt;strong&gt;Authentication&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Enable &lt;strong&gt;Anonymous Authentication&lt;/strong&gt; if needed.&lt;/li&gt;
&lt;li&gt;If additional authentication is required, enable &lt;strong&gt;Windows Authentication&lt;/strong&gt; or &lt;strong&gt;Basic Authentication&lt;/strong&gt;.&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  Step 7: Configure SSL Certificate (Optional but Recommended)
&lt;/h2&gt;

&lt;h3&gt;
  
  
  7.1 Obtain an SSL Certificate
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;You can get a free certificate from &lt;a href="https://letsencrypt.org/" rel="noopener noreferrer"&gt;Let's Encrypt&lt;/a&gt; or purchase a commercial one.&lt;/li&gt;
&lt;li&gt;Install the certificate on the server.&lt;/li&gt;
&lt;li&gt;Associate it with the HTTPS binding.&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  Step 8: Test the Application
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Start the site in IIS (select the site and click &lt;strong&gt;Start&lt;/strong&gt; in the right panel).&lt;/li&gt;
&lt;li&gt;Open a browser and visit your application's URL (e.g., &lt;code&gt;https://myapp.com&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;Verify that the application loads correctly and the SSL certificate is active (green lock in the address bar).&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  Configure HTTP to HTTPS Redirects in IIS
&lt;/h2&gt;

&lt;p&gt;When deploying an application in production, it's a good practice to redirect all HTTP traffic to HTTPS to ensure secure connections. Here's how to do it in IIS, either through the &lt;code&gt;web.config&lt;/code&gt; file or via a reverse proxy.&lt;/p&gt;

&lt;h3&gt;
  
  
  Option 1: HTTP to HTTPS Redirect in &lt;code&gt;web.config&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;You can configure the redirect directly in the &lt;code&gt;web.config&lt;/code&gt; file of your ASP.NET application. This method is ideal if you're not using a reverse proxy.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Steps:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Open the &lt;code&gt;web.config&lt;/code&gt; file of your application.&lt;/li&gt;
&lt;li&gt;Add the following URL rewrite rules inside the &lt;code&gt;&amp;lt;system.webServer&amp;gt;&lt;/code&gt; section:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight xml"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;configuration&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;system.webServer&amp;gt;&lt;/span&gt;
 &lt;span class="nt"&gt;&amp;lt;rewrite&amp;gt;&lt;/span&gt;
   &lt;span class="nt"&gt;&amp;lt;rules&amp;gt;&lt;/span&gt;
     &lt;span class="nt"&gt;&amp;lt;rule&lt;/span&gt; &lt;span class="na"&gt;name=&lt;/span&gt;&lt;span class="s"&gt;"HTTP to HTTPS Redirect"&lt;/span&gt; &lt;span class="na"&gt;stopProcessing=&lt;/span&gt;&lt;span class="s"&gt;"true"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
       &lt;span class="nt"&gt;&amp;lt;match&lt;/span&gt; &lt;span class="na"&gt;url=&lt;/span&gt;&lt;span class="s"&gt;"(.*)"&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
       &lt;span class="nt"&gt;&amp;lt;conditions&amp;gt;&lt;/span&gt;
         &lt;span class="nt"&gt;&amp;lt;add&lt;/span&gt; &lt;span class="na"&gt;input=&lt;/span&gt;&lt;span class="s"&gt;"{HTTPS}"&lt;/span&gt; &lt;span class="na"&gt;pattern=&lt;/span&gt;&lt;span class="s"&gt;"off"&lt;/span&gt; &lt;span class="na"&gt;ignoreCase=&lt;/span&gt;&lt;span class="s"&gt;"true"&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
       &lt;span class="nt"&gt;&amp;lt;/conditions&amp;gt;&lt;/span&gt;
       &lt;span class="nt"&gt;&amp;lt;action&lt;/span&gt; &lt;span class="na"&gt;type=&lt;/span&gt;&lt;span class="s"&gt;"Redirect"&lt;/span&gt; &lt;span class="na"&gt;url=&lt;/span&gt;&lt;span class="s"&gt;"https://{HTTP_HOST}/{R:1}"&lt;/span&gt; &lt;span class="na"&gt;redirectType=&lt;/span&gt;&lt;span class="s"&gt;"Permanent"&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
     &lt;span class="nt"&gt;&amp;lt;/rule&amp;gt;&lt;/span&gt;
   &lt;span class="nt"&gt;&amp;lt;/rules&amp;gt;&lt;/span&gt;
 &lt;span class="nt"&gt;&amp;lt;/rewrite&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/system.webServer&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/configuration&amp;gt;&lt;/span&gt;

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

&lt;/div&gt;



&lt;h2&gt;
  
  
  Explanation
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Option 1: HTTP to HTTPS Redirect in &lt;code&gt;web.config&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;When configuring a redirect in the &lt;code&gt;web.config&lt;/code&gt; file, the following rules are applied:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;&amp;lt;match url="(.*)" /&amp;gt;&lt;/code&gt;&lt;/strong&gt;: Captures all URLs.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;&amp;lt;conditions&amp;gt;&lt;/code&gt;&lt;/strong&gt;: Checks if the request is not HTTPS (&lt;code&gt;{HTTPS} = off&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;&amp;lt;action type="Redirect" /&amp;gt;&lt;/code&gt;&lt;/strong&gt;: Redirects to the same URL but with &lt;code&gt;https://&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This method is ideal if you're not using a reverse proxy and want to handle the redirect directly within your ASP.NET application.&lt;/p&gt;




&lt;h3&gt;
  
  
  Option 2: HTTP to HTTPS Redirect in a Reverse Proxy
&lt;/h3&gt;

&lt;p&gt;If you're using a reverse proxy (like Apache, Nginx, or Azure Application Gateway), the redirect should be configured in the proxy, not in IIS. This avoids conflicts and ensures traffic is handled correctly.&lt;/p&gt;

&lt;h4&gt;
  
  
  Example with Nginx
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;Open the Nginx configuration file (e.g., &lt;code&gt;/etc/nginx/nginx.conf&lt;/code&gt; or &lt;code&gt;/etc/nginx/sites-available/default&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;Add the following configuration to redirect HTTP to HTTPS:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight nginx"&gt;&lt;code&gt;&lt;span class="k"&gt;server&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kn"&gt;listen&lt;/span&gt; &lt;span class="mi"&gt;80&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kn"&gt;server_name&lt;/span&gt; &lt;span class="s"&gt;myapp.com&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="c1"&gt;# Redirect all HTTP traffic to HTTPS&lt;/span&gt;
    &lt;span class="kn"&gt;return&lt;/span&gt; &lt;span class="mi"&gt;301&lt;/span&gt; &lt;span class="s"&gt;https://&lt;/span&gt;&lt;span class="nv"&gt;$host$request_uri&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;server&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kn"&gt;listen&lt;/span&gt; &lt;span class="mi"&gt;443&lt;/span&gt; &lt;span class="s"&gt;ssl&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kn"&gt;server_name&lt;/span&gt; &lt;span class="s"&gt;myapp.com&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="c1"&gt;# SSL configuration&lt;/span&gt;
    &lt;span class="kn"&gt;ssl_certificate&lt;/span&gt; &lt;span class="n"&gt;/path/to/certificate.crt&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kn"&gt;ssl_certificate_key&lt;/span&gt; &lt;span class="n"&gt;/path/to/private.key&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="c1"&gt;# Pass traffic to IIS&lt;/span&gt;
    &lt;span class="kn"&gt;location&lt;/span&gt; &lt;span class="n"&gt;/&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="kn"&gt;proxy_pass&lt;/span&gt; &lt;span class="s"&gt;http://localhost:80&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;  &lt;span class="c1"&gt;# Adjust the port if necessary&lt;/span&gt;
        &lt;span class="kn"&gt;proxy_set_header&lt;/span&gt; &lt;span class="s"&gt;Host&lt;/span&gt; &lt;span class="nv"&gt;$host&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="kn"&gt;proxy_set_header&lt;/span&gt; &lt;span class="s"&gt;X-Real-IP&lt;/span&gt; &lt;span class="nv"&gt;$remote_addr&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="kn"&gt;proxy_set_header&lt;/span&gt; &lt;span class="s"&gt;X-Forwarded-For&lt;/span&gt; &lt;span class="nv"&gt;$proxy_add_x_forwarded_for&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="kn"&gt;proxy_set_header&lt;/span&gt; &lt;span class="s"&gt;X-Forwarded-Proto&lt;/span&gt; &lt;span class="nv"&gt;$scheme&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Explanation
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;First &lt;code&gt;server&lt;/code&gt; block&lt;/strong&gt;: Redirects all HTTP traffic (port 80) to HTTPS (port 443).&lt;br&gt;&lt;br&gt;
This ensures that any request coming over HTTP is automatically upgraded to a secure HTTPS connection.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Second &lt;code&gt;server&lt;/code&gt; block&lt;/strong&gt;: Handles HTTPS traffic and redirects it to IIS.&lt;br&gt;&lt;br&gt;
This block manages the secure traffic and ensures it is properly routed to your application.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  Why Can't You Have Both Configurations at the Same Time?
&lt;/h3&gt;

&lt;p&gt;If you configure the redirect in both &lt;code&gt;web.config&lt;/code&gt; and the reverse proxy, conflicts and unexpected behaviors may occur, such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Double redirection&lt;/strong&gt;: The browser might receive multiple redirect instructions, causing errors or infinite loops.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Loss of information&lt;/strong&gt;: Headers or other request data might be lost during the redirect process, leading to broken functionality.&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  Recommendation
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;If you use a reverse proxy&lt;/strong&gt;:&lt;br&gt;&lt;br&gt;
Configure the HTTP to HTTPS redirect in the proxy (e.g., Nginx, Apache) and &lt;strong&gt;disable any redirects in IIS&lt;/strong&gt;. Avoid using the rewrite rule in &lt;code&gt;web.config&lt;/code&gt; to prevent conflicts.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;If you don't use a reverse proxy&lt;/strong&gt;:&lt;br&gt;&lt;br&gt;
Configure the redirect in the &lt;code&gt;web.config&lt;/code&gt; file of your application. This ensures that IIS handles the redirection directly.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;




</description>
      <category>aspnet</category>
      <category>iis</category>
      <category>webdev</category>
      <category>csharp</category>
    </item>
    <item>
      <title>Cloud, Containers, and Kubernetes: Fundamentals for Developers</title>
      <dc:creator>Samira Awad</dc:creator>
      <pubDate>Wed, 23 Oct 2024 03:30:47 +0000</pubDate>
      <link>https://dev.to/samirabawad/cloud-containers-and-kubernetes-fundamentals-for-developers-pn1</link>
      <guid>https://dev.to/samirabawad/cloud-containers-and-kubernetes-fundamentals-for-developers-pn1</guid>
      <description>&lt;h2&gt;
  
  
  Introduction to Cloud and Containerization
&lt;/h2&gt;

&lt;p&gt;In this article, we will explore what the cloud is and how it relates to containerization, focusing on technologies like Docker and Kubernetes. To understand these concepts effectively, we will also discuss Linux, as much of the cloud infrastructure is based on this operating system.&lt;/p&gt;

&lt;h2&gt;
  
  
  Linux as an Operating System
&lt;/h2&gt;

&lt;p&gt;An operating system is a set of programs that allows a device to function. Examples include Windows, Linux, and macOS on computers, and Android and iOS on mobile devices. Linux, being open source, is used by many companies and individuals worldwide, resulting in various distributions tailored to different needs. Additionally, Linux dominates servers and supercomputers due to its flexibility and efficiency, primarily managed through command lines.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Cloud: What Is It Exactly?
&lt;/h2&gt;

&lt;p&gt;When we say an application stores data in the cloud, we mean that this data is on a server that the application accesses via the internet. This server is generally located in a datacenter alongside other servers from different companies, although it could also be in a private location. The physical location of the server does not matter; what is important is the remote connection and access.&lt;/p&gt;

&lt;p&gt;In more technical terms, "cloud" also refers to the IT infrastructure that we outsource to providers like Microsoft, Amazon, or Google. These providers lease us computing resources (servers, storage, etc.) from their datacenters, allowing us to run cloud services without worrying about hardware maintenance. This offers flexibility, as we can hire servers based on demand and only pay for the time used. This model, popularized by Amazon with its Elastic Infrastructure service (which automatically increases or decreases the number of servers in minutes based on service demand), has revolutionized how we manage servers.&lt;/p&gt;

&lt;h2&gt;
  
  
  Linux in the Cloud and on Servers
&lt;/h2&gt;

&lt;p&gt;Due to its stability, security, and efficiency, Linux is the most used operating system in the cloud and on virtual servers. Many companies have migrated their servers to the cloud, making "cloud" and "internet" practically synonymous for many. The open-source nature of Linux allows the community to audit it and quickly identify vulnerabilities, providing a significant security advantage over closed systems.&lt;/p&gt;

&lt;p&gt;Moreover, Linux is more cost-effective as it does not require usage licenses, making it a preferred choice for companies that manage large numbers of servers. With advanced tools for remote and automated management, Linux enables efficient administration of hundreds or thousands of machines.&lt;/p&gt;

&lt;h2&gt;
  
  
  Servers and the Dominance of Linux
&lt;/h2&gt;

&lt;p&gt;Managing and configuring servers via the command line is more efficient and allows for better remote administration compared to graphical interfaces. This is why Linux dominates in virtual servers and the cloud, compared to other operating systems.&lt;/p&gt;

&lt;p&gt;In terms of costs, it is a more economical option as it does not require licenses, unlike its competitors, where each server needs one. Additionally, a company providing a service may have many servers. In the 2000s, it became possible to have a server with multiple virtual machines inside, whether physical or in the cloud.&lt;/p&gt;

&lt;p&gt;Regarding security, being open source allows the community to audit it and detect vulnerabilities more rapidly, which is not possible in closed systems. In other systems, only company personnel have access to the code, and only they can identify security flaws.&lt;/p&gt;

&lt;p&gt;It is called the cloud because, a long time ago, in network diagrams, a cloud drawing was used to represent external networks where one did not know what was happening. As the internet grew, that external network became synonymous with the internet, where "cloud" was used in computing to represent it.&lt;/p&gt;




&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F67trtsqrrgw7yfxmrk94.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F67trtsqrrgw7yfxmrk94.png" alt="Image description" width="800" height="190"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  From the Cloud to Containers: Docker as an Efficient Solution
&lt;/h2&gt;

&lt;p&gt;The cloud has transformed how companies manage and deploy applications, allowing them to leverage scalable and flexible infrastructures without worrying about the physical maintenance of servers. However, as applications grow in complexity, the need for more efficient solutions to manage dependencies, environments, and scalability arises.&lt;/p&gt;

&lt;p&gt;This is where containerization comes into play, a technology that has revolutionized software development and deployment in the cloud. Docker, the most popular container system, simplifies the packaging of applications with all their dependencies, ensuring they run consistently in any environment, whether local or in the cloud. Next, we will explore how Docker and containers have changed how applications are distributed, executed, and scaled in cloud infrastructure.&lt;/p&gt;

&lt;h2&gt;
  
  
  Software Containers
&lt;/h2&gt;

&lt;p&gt;Containers are a way to distribute and run applications in isolation. They contain the application along with all its dependencies, solving common compatibility issues between environments. In traditional installations, dependencies (packages and services) are managed separately, but many computers have different versions and configurations of these dependencies, creating problems.&lt;/p&gt;

&lt;p&gt;As a solution, containers include everything needed for the application to function correctly in any system, regardless of the environment configuration.&lt;/p&gt;

&lt;h3&gt;
  
  
  Problems that Containers Solve
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Distribution&lt;/strong&gt;: Imagine you develop an application that works on your computer but not on others. Locating configuration differences can be complicated and slow. Containers address this issue by packaging the application with its dependencies and configurations in an image, ensuring it works the same way on any system. The downside is that images can take up more space, especially if the application has many dependencies. This is why containers are mainly used for applications running on servers, where it is crucial that what works on the developer's computer also works on the server.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Execution&lt;/strong&gt;: Running an application in a container is similar to running any other app, but with the advantage that containers are isolated. This means we can limit the container's access to system resources (CPU, memory, etc.), preventing it from interfering with other running applications. Although this isolation is less than that of virtual machines, it is sufficient for most cases and allows for more efficient and controlled use of resources.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Difference Between Virtual Machines and Containers
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Containers&lt;/strong&gt;: Use the same kernel of the operating system to run multiple applications, each isolated in its environment but sharing the same operating system.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Virtual Machines&lt;/strong&gt;: Simulate a complete computer with its operating system and kernel. This provides greater isolation between applications and more information security but requires more resources.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Containers are lighter than virtual machines, and although they do not offer the same level of isolation, they are often sufficient for most applications. The most popular container system is Docker. For example, if we develop a website in a container, we can replicate the image across different servers to ensure availability. If something happens to the server where it is running, we can copy that same file (image) to another server, one that is functioning correctly, saving work.&lt;/p&gt;

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




&lt;h2&gt;
  
  
  Kubernetes: Container Orchestrator
&lt;/h2&gt;

&lt;p&gt;Kubernetes is a system for orchestrating containers, helping to manage, scale, and maintain applications distributed across them. "Scaling" means increasing or decreasing the number of containers based on demand, such as in a website that experiences more traffic at certain times of the day.&lt;/p&gt;

&lt;p&gt;This saves costs by not running containers that are not being used. We can launch more replicas when demand is higher and reduce them when it is lower. These replicas can be launched on the same server, different servers, or even on different servers in various parts of the world to be closer to the users viewing the page.&lt;/p&gt;

&lt;p&gt;Kubernetes handles:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Launching containers when needed and stopping them when no longer required.&lt;/li&gt;
&lt;li&gt;Balancing the load between containers by distributing user requests among several containers to optimize performance.&lt;/li&gt;
&lt;li&gt;Running on a cluster of servers, launching applications on servers with greater availability.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Kubernetes can run on one or more servers, forming a cluster. This cluster is the set of servers available to run applications. When Kubernetes needs to run a new replica of the application (referred to as a "pod" in computing), it checks which server has availability and launches the app on that server.&lt;/p&gt;

&lt;p&gt;We can think about how the pods running within the cluster interconnect, how they send network information to each other; there are various ways to send this information within the cluster. We can also consider how new applications, for example, new versions, can be launched without interrupting our service.&lt;/p&gt;

&lt;h3&gt;
  
  
  In Summary
&lt;/h3&gt;

&lt;p&gt;Kubernetes is an ideal infrastructure tool for large applications, as it automates the management of multiple containers across different servers, facilitating scalability and availability. It is not recommended for small systems, as its complexity and cost do not justify the benefits. &lt;/p&gt;

&lt;p&gt;Choosing which components to use, how they will interconnect, and how to configure them can be somewhat challenging to manage. This is why most cloud providers offer managed Kubernetes. These come preconfigured and installed with specified components, allowing us to focus solely on deploying our applications in the ready-to-use Kubernetes cluster provided by the cloud provider.&lt;/p&gt;

&lt;h3&gt;
  
  
  History of Kubernetes
&lt;/h3&gt;

&lt;p&gt;Kubernetes is a set of software components that collectively provide this infrastructure. It was created by Google in 2015 as an open-source project under the Apache license. The name comes from Greek and means "ship's captain." One of the key decisions was to make it extensible, meaning these software components can be improved, extended, or replaced to provide better functionalities. This has led to projects that add or change Kubernetes components to offer enhanced infrastructure capabilities.&lt;/p&gt;

&lt;h2&gt;
  
  
  Microservices and Kubernetes
&lt;/h2&gt;

&lt;p&gt;Microservices break down a large application into smaller components, where each fulfills a specific task and communicates with other parts by sending packets over the network. For example, one part of a website shows news, another shows related news, another handles comments, and another manages authentication.&lt;/p&gt;

&lt;p&gt;In the past, it was common to have a single large site/app that encompassed everything, so if we needed the app to handle more demand and have greater availability, the entire system had to grow as a single entity. The microservices architecture allows services to be scaled individually based on their needs. For instance, the service displaying the homepage of a website may require more replicas than the authentication service due to higher traffic demand.&lt;/p&gt;

&lt;p&gt;Kubernetes simplifies the management of microservices, as it automatically adds and removes replicas, distributes traffic, and streamlines administration.&lt;/p&gt;

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

&lt;p&gt;The cloud offers great flexibility: with a click, we can add servers, storage space, configure backups, create databases, or enable global load balancing. However, this level of ease and elasticity comes at a cost, and it is not always the best option for all companies.&lt;/p&gt;

&lt;p&gt;For organizations that already have the necessary infrastructure, the cloud may not be the most economical choice. But for those starting out and requiring a scalable solution, the cloud can be ideal, significantly reducing the workload. Some companies also opt for a hybrid strategy, maintaining part of their infrastructure locally while leveraging the cloud for services requiring more flexibility.&lt;/p&gt;

&lt;p&gt;Kubernetes is a powerful tool for managing applications that use containers, especially in microservices environments. While it is a complex infrastructure, it is extremely useful for large applications requiring scalability and high availability. Cloud providers typically offer managed Kubernetes, reducing complexity and allowing developers to focus on deploying their applications.&lt;/p&gt;




&lt;h2&gt;
  
  
  Jobs Related to the Cloud
&lt;/h2&gt;

&lt;p&gt;When a job posting mentions "cloud infrastructure," it usually refers to the ability to handle different cloud service providers and the products they offer. People working in this field utilize resources provided by providers like Amazon, Google, or Microsoft to deploy and maintain applications. For example, in a development team, the frontend manages the application that interacts with users, while the backend handles services running on the cloud infrastructure.&lt;/p&gt;

&lt;p&gt;Those maintaining cloud services need to know how to use virtual servers, storage systems, databases, and monitoring tools, among other services provided by these providers.&lt;/p&gt;

&lt;p&gt;If the job posting refers to "cloud technologies," it may be talking about tools related to the Cloud Native Computing Foundation (CNCF). This foundation, created around Kubernetes, groups together a series of open-source projects used alongside Kubernetes to create cloud-native solutions. These technologies are designed to work on elastic infrastructures, leveraging containers, microservices, and other dynamic functionalities.&lt;/p&gt;

&lt;p&gt;Additionally, there is the option to work on developing the cloud infrastructure itself, being part of the team that ensures servers are always available and functioning correctly.&lt;/p&gt;




&lt;p&gt;*&lt;em&gt;--My Own Notes Taken from the Brilliant Content of "Aprendiendo con Marga" &amp;lt;3--&lt;br&gt;
*&lt;/em&gt;&lt;/p&gt;

</description>
      <category>linux</category>
      <category>docker</category>
      <category>kubernetes</category>
      <category>cloud</category>
    </item>
    <item>
      <title>Operating systems: Which one to use as a developer and why?</title>
      <dc:creator>Samira Awad</dc:creator>
      <pubDate>Fri, 18 Oct 2024 15:41:49 +0000</pubDate>
      <link>https://dev.to/samirabawad/operating-systems-which-one-to-use-as-a-developer-and-why-52lm</link>
      <guid>https://dev.to/samirabawad/operating-systems-which-one-to-use-as-a-developer-and-why-52lm</guid>
      <description>&lt;p&gt;First, we must clearly understand the concept of an operating system:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What is an Operating System?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;It is a set of programs that allows a device to function. Among them are Windows, Linux, and macOS for computers, and Android and iOS for mobile devices. Other devices like smart TVs or robots also have their own operating systems.&lt;/p&gt;

&lt;p&gt;A device with just the operating system cannot do much. To make it useful, we use software applications installed on top of it. The operating system serves to provide services to these applications. Tasks such as manipulating file information, displaying images on the screen, configuring and using the network, switching between different running applications (which allows us to listen to music while writing a document), among others.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Kernel&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;An operating system is composed of different parts. The core of the operating system is the Kernel. It manages low-level operations (small tasks) such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Access to the processor at any given moment&lt;/li&gt;
&lt;li&gt;The memory assigned to an app in execution&lt;/li&gt;
&lt;li&gt;And controlling peripherals (screen, keyboard, etc.)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In other words, it allows interaction between software and hardware in an orderly and secure way (it is the part of our software that runs in privileged mode), by controlling the network card, sending, receiving, and updating each packet of data, without caring about the information inside them. In the same way, it manipulates the pixels displayed on the screen without considering what they represent.&lt;/p&gt;

&lt;p&gt;The processor can execute millions of operations per second. It does this through an algorithm that decides how processor time is allocated. The kernel divides processing time among many apps to maintain the illusion of simultaneity.&lt;/p&gt;

&lt;p&gt;Then, the higher-level libraries and apps of the operating system gather, decode, and convert this into a sequence of information, providing services to the end applications.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Types of Kernel&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Microkernel:&lt;/strong&gt;&lt;br&gt;
It is very small, and its code is limited to doing the minimum necessary for the device to function. Other tasks are provided by external services that communicate via the kernel.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;Benefit:&lt;/strong&gt;&lt;/em&gt; If a specific service fails, the failure is isolated to that service. In other words, it isolates failures.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;/em&gt; The driver of the network card that handles sending and receiving data packets would not be part of the kernel, but a service that communicates with the kernel.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Monolithic Kernel:&lt;/strong&gt;&lt;br&gt;
Many operations are carried out in the same kernel.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;Benefit:&lt;/strong&gt;&lt;/em&gt; Time is better utilized since it doesn’t have to pass messages between different services.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;/em&gt; Linux Kernel.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Hybrid Kernel:&lt;/strong&gt;&lt;br&gt;
The most important tasks are performed in the kernel, and less important tasks are done outside of it.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;Benefit:&lt;/strong&gt;&lt;/em&gt; It shares the benefits of both types of kernels, improving performance on critical tasks while isolating failures in less important ones.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;/em&gt; Windows and macOS Kernel. Drivers for the network card or the file system are part of the kernel, while less important ones, such as a webcam, are external.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7l0pns1lwll4lf168h82.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7l0pns1lwll4lf168h82.png" alt="Image description" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Differences between Windows, Linux, and macOS&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Now that we know exactly what an operating system is and what it does, let's look at their differences.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;1. Linux:&lt;/strong&gt;&lt;br&gt;
Mainly managed through command lines. Almost the entire web is based on Linux because almost all supercomputers and high-capacity servers use it. Moreover, the most widely used mobile operating system is Android, which is based on the Linux kernel.&lt;/p&gt;

&lt;p&gt;Being open-source, it is developed by many people around the world. As a result, different Linux distributions have emerged in response to the need for changes.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;Distributions&lt;/strong&gt;&lt;/em&gt;&lt;br&gt;&lt;br&gt;
Software projects with specific goals (e.g., being beginner-friendly, secure, minimal installation, etc.) that group applications and prepare them for use.&lt;/p&gt;

&lt;p&gt;With this, users can obtain a more or less customized operating system for what they want to do. However, this can increase the learning curve since there are quite a few distributions.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Example:&lt;/em&gt; Ubuntu, which facilitates usage and reduces the learning curve, aiming to expand its use on desktop computers.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;History of Linux&lt;/strong&gt;&lt;/em&gt;&lt;br&gt;
&lt;em&gt;&lt;strong&gt;UNIX&lt;/strong&gt;&lt;/em&gt;&lt;br&gt;
It was an operating system created in the 1970s. Initially developed for a game, it expanded into a more complex operating system.&lt;br&gt;&lt;br&gt;
It operated entirely through text, even input devices (like the keyboard) and output devices. This is where the name of the &lt;code&gt;print()&lt;/code&gt; function comes from, as these old computers had printers instead of screens.&lt;/p&gt;

&lt;p&gt;It was written in machine language, but they decided to rewrite it to be compatible with other computers, creating the &lt;em&gt;&lt;strong&gt;C&lt;/strong&gt;&lt;/em&gt; programming language for it. The focus of this system was simplicity, aiming to perform small tasks but do them well, which was key to its success.&lt;/p&gt;

&lt;p&gt;Initially, it was distributed openly, but due to a change in law in the 1980s, the code became closed, losing the possibility for collaboration and/or study. As a result, companies like IBM or HP started commercializing it in different versions.&lt;/p&gt;

&lt;p&gt;In response, the GNU project was born, aiming to create a similar and open system, creating different kernels, the most important of which was &lt;em&gt;&lt;strong&gt;Linux&lt;/strong&gt;&lt;/em&gt;, created by Linus Torvalds. This kernel, along with the tools developed by GNU, created the operating system that aims to be maintainable and upgradable over time.&lt;/p&gt;

&lt;p&gt;For the different versions of UNIX, the &lt;strong&gt;POSIX&lt;/strong&gt; standard was created, which all had to comply with, including Linux.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;Linux Growth&lt;/strong&gt;&lt;/em&gt;&lt;br&gt;
Due to its large community, bugs have been quickly fixed, and it has gained a reputation for being more stable and secure. With the rise of the cloud, Linux grew enormously, as most servers use it.&lt;/p&gt;

&lt;p&gt;Today, Linux has taken most of the market in servers and is gaining more of the market in personal computers, which has incentivized computer manufacturers to include the necessary code to make their devices work directly in the Linux kernel, without waiting for the community to include them.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;Pipes&lt;/strong&gt;&lt;/em&gt;&lt;br&gt;
They created this concept, which allows connecting the output of one command with the input of another, enabling more complex operations, automating processes, and generating great flexibility—a key advantage in managing large-scale systems. For this reason, the cloud has boosted its use, due to its ability to create and destroy virtual servers with ease.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;Benefits:&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Total hardware control:&lt;/strong&gt; Allows complete customization for managing and optimizing resources.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Simplicity and flexibility:&lt;/strong&gt; Customizable to multiple scenarios and focused on doing one task well at a time.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Free and open-source software:&lt;/strong&gt; No licensing costs.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Efficiency and scalability:&lt;/strong&gt; Known for efficient performance, ideal for applications requiring high processing capacity and growth.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Advanced automation:&lt;/strong&gt; Facilitates task automation and management through scripts and text-based commands, optimizing daily administration.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Linux mastery:&lt;/strong&gt; Opens up many professional opportunities, as nearly the entire web is based on it.&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;strong&gt;2. Windows&lt;/strong&gt;&lt;br&gt;
&lt;em&gt;&lt;strong&gt;History&lt;/strong&gt;&lt;/em&gt;&lt;br&gt;
&lt;em&gt;&lt;strong&gt;DOS&lt;/strong&gt;&lt;/em&gt;&lt;br&gt;
An operating system created in the 1980s by Bill Gates for IBM's personal computers. These computers were later manufactured by other companies. This system was mainly text-based, but unlike UNIX, it was designed to be used by a single user on personal computers.&lt;/p&gt;

&lt;p&gt;Windows was created as the graphical interface for this operating system, and it became the main operating system, while DOS became the command line. As newer versions were released, the command line took on a less important role, as it was designed to be managed, configured, and installed graphically.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Windows Growth&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Many companies traditionally adopted it as their base operating system. For this reason, it is one of the most used. Traditionally, it has been more compatible with peripherals and hardware, due to agreements manufacturers had with Microsoft (unlike Linux, which relies on the community to add hardware support to the kernel).&lt;/p&gt;

&lt;p&gt;In the development world, it used to have high incompatibility. Web development could only be done with Internet Explorer, and for IDEs, Visual Studio was required. Its environment was very restricted, leading to applications being developed only for Windows. Additionally, a license fee is required to use it.&lt;/p&gt;

&lt;p&gt;For these reasons, it is not ideal for developers seeking to automate tasks or interact with virtual servers.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Integration of WSL&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Windows has integrated a Linux kernel into its operating system, called &lt;strong&gt;WSL&lt;/strong&gt; (Windows Subsystem for Linux). This allows Linux to run within the Windows system. While it won't have the same performance as a native operating system, it serves as a learning tool, and its version 2 is closer to a virtual machine.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Benefit:&lt;/strong&gt; It combines the ease of use of Windows with the benefits of using Linux.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;3. macOS&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;History:&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
It was born in the 2000s, based on UNIX. The part of this operating system that organizes files and commands is open-source and is called &lt;strong&gt;Darwin&lt;/strong&gt;, but the graphical interface it provides is closed-source.&lt;/p&gt;

&lt;p&gt;A few years ago, it was known for its incompatibility and restrictions, but today it has software available for most tasks. Apple has developed its own M1 processors, offering great speed.&lt;/p&gt;

&lt;p&gt;This operating system is only compatible with Apple hardware. This allows for less flexibility but more control and stability. On the other hand, its hardware is more expensive, and licenses are required to use it.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fk1jzuqz9c688zl8pzs8b.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fk1jzuqz9c688zl8pzs8b.jpeg" alt="Image description" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;The Best Operating System for a Developer&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
There is no one best operating system, but each has advantages depending on the developer’s profile. All of these systems are compatible with development tools, programming languages, and the cloud.&lt;br&gt;&lt;br&gt;
The choice depends on several factors:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The hardware.&lt;/li&gt;
&lt;li&gt;The compatibility of software with the architecture of the operating system.&lt;/li&gt;
&lt;li&gt;And most importantly, the developer’s resilience: the ability to adapt to a new environment.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If we want to manage cloud servers, Linux is the predominant option. However, for local or personal development, the ideal operating system depends on the developer. Still, learning Linux is beneficial to increase versatility, even if you're not managing servers.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Servers and Linux Mastery&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Managing and configuring servers through the command line is more efficient and allows for better remote administration compared to graphical interfaces. This is why Linux dominates virtual and cloud servers.&lt;br&gt;&lt;br&gt;
In terms of cost, it is a more economical option because it doesn’t require licenses, unlike Windows or Mac, where each server needs one. Additionally, a company providing a service may have many servers. In the 2000s, it became possible to have a server with many virtual machines inside, whether physical or cloud-based.&lt;/p&gt;

&lt;p&gt;In terms of security, being open-source allows the community to audit it and detect vulnerabilities faster, something that is not possible with closed systems. In other systems, only people within the company have access to the code, and only those people can find security flaws.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Basic Development Environment for a Developer&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Regardless of the operating system, there are essential tools that every developer should have:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. WSL (Windows Subsystem for Linux):&lt;/strong&gt; Allows you to work in a Linux environment without having to switch operating systems.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;How to install WSL:&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Go to Control Panel &amp;gt; Programs &amp;gt; Turn Windows features on or off.&lt;/li&gt;
&lt;li&gt;Check the box for Windows Subsystem for Linux (WSL).&lt;/li&gt;
&lt;li&gt;Restart your computer to apply the changes.&lt;/li&gt;
&lt;li&gt;Open the Microsoft Store and search for the Linux distribution you prefer, such as Ubuntu, Kali, and others. Then install it.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;To interact with these distributions, you can use Windows Terminal, an application that allows you to open multiple terminals such as Ubuntu, PowerShell, or CMD in tabs. Windows Terminal also offers benefits like better performance, color customization, and more control over terminal windows, enhancing the development experience.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Docker Desktop:&lt;/strong&gt; Simplifies working with containers, both locally and in the cloud.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Visual Studio Code (VSC):&lt;/strong&gt; A versatile editor that supports multiple languages and technologies. It’s the default choice for developers.&lt;/p&gt;

&lt;p&gt;With these three tools, we can make the following development decisions for backend, frontend, DevOps, and programming language choices.&lt;/p&gt;




&lt;p&gt;--My Own Notes Taken from the Brilliant Content of "Aprendiendo con Marga" &amp;lt;3--&lt;br&gt;
I hope they are of some help.&lt;/p&gt;

</description>
      <category>linux</category>
      <category>webdev</category>
      <category>beginners</category>
      <category>programming</category>
    </item>
    <item>
      <title>New Version of Angular: Angular 17 CHANGES:</title>
      <dc:creator>Samira Awad</dc:creator>
      <pubDate>Wed, 02 Oct 2024 04:02:57 +0000</pubDate>
      <link>https://dev.to/samirabawad/new-version-of-angular-angular-17-changes-g1h</link>
      <guid>https://dev.to/samirabawad/new-version-of-angular-angular-17-changes-g1h</guid>
      <description>&lt;p&gt;&lt;strong&gt;1. New website:&lt;/strong&gt; We will have new documentation, tutorials, and a playground section where we can run code live.&lt;/p&gt;

&lt;p&gt;It will no longer be called angular.io, but angular.dev. The logo has also changed.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Change in syntax:&lt;/strong&gt; New syntax in HTML template:&lt;/p&gt;

&lt;p&gt;Angular 17 changes the HTML syntax. One benefit of this new syntax is that it is integrated into the language itself, so we don’t have to import anything to use if, for, and switch.&lt;/p&gt;

&lt;p&gt;Now, the if, for, and switch blocks are placed outside of HTML tags, allowing us to use else-if and else. In the for loop, an empty section is included that will be executed if the array is empty. With this change, the iterations in the for loop have increased their performance by 90%, as it is now mandatory to use track by:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnbs7kk6ssw8l5s6pezr6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnbs7kk6ssw8l5s6pezr6.png" alt="Image description" width="293" height="94"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fza48l30dschzhg6op498.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fza48l30dschzhg6op498.png" alt="Image description" width="296" height="101"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvegdupk965q3ygwrfgoh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvegdupk965q3ygwrfgoh.png" alt="Image description" width="220" height="140"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Track involves specifying which ID the array contains to identify each element, improving performance.&lt;/p&gt;

&lt;p&gt;Previous Versions:&lt;/p&gt;

&lt;p&gt;They used ngIf, ngFor, and ngSwitch. The change is due to Angular using the Zone.js library for these directives, which is not very optimized. To improve its performance, this syntax change was made.&lt;/p&gt;

&lt;p&gt;Before, these directive libraries needed to be imported: CommonModule, ngIf, among others.&lt;/p&gt;

&lt;p&gt;These library tags are used in HTML tags:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftpl2abdl0mtzcpkax43r.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftpl2abdl0mtzcpkax43r.png" alt="Image description" width="180" height="121"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fymtmzk6er6685fokru6v.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fymtmzk6er6685fokru6v.png" alt="Image description" width="252" height="118"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwq8mtvomtqqz2yqsewdi.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwq8mtvomtqqz2yqsewdi.png" alt="Image description" width="436" height="107"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Moreover, previous versions do not have the empty section. To check if an array is empty, a conditional is used.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Stable hydration added in SSR.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;We had it available as a developer preview, and it is now available stably. Hydration significantly improves the performance of SSR applications, as without hydration, there was always a flicker whenever the application loaded because it first loaded on the server and then on the client. With hydration, this process is improved.&lt;/p&gt;

&lt;p&gt;*&lt;em&gt;4. Stable addition of signals.&lt;br&gt;
*&lt;/em&gt;&lt;br&gt;
These have been available since Angular 16, but now they will be stable.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5. Projects will come as standalone by default, without modules.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Since Angular 16, standalone components can be created: &lt;code&gt;ng g c --standalone components/folder&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;In Angular 17, all components are created as standalone by default.&lt;/p&gt;

&lt;p&gt;Before these versions, a component had a module that declared and exported the component. To use these components in the app module, the module had to be imported:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F07jvdy8fz4gyj0wojrns.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F07jvdy8fz4gyj0wojrns.png" alt="Image description" width="223" height="208"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;However, with standalone components, modules are no longer needed, so the standalone component is imported directly in imports. The component has standalone: true, and in its imports, we can import what that component needs. CommonModule acts as the module internally:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqnowwv0xye9w9zwmx0ir.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqnowwv0xye9w9zwmx0ir.png" alt="Image description" width="281" height="198"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Command to migrate to standalone: &lt;code&gt;ng generate @angular/core:standalone&lt;/code&gt;. Or we can simply add these properties to the normal component to make it standalone and remove its module.&lt;/p&gt;

&lt;p&gt;Standalone components can be mixed with those that are not. It is recommended to create new components as standalone, even in older projects.&lt;/p&gt;

&lt;p&gt;This can also be used in directives, pipes, and components, which will no longer go in declarations but in imports.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;6. Adds defer for lazy loading at the component level.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This allows lazy loading for components that are not visible in the viewport, preventing loading if scrolling is not needed.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;7. Switching from Webpack to using esbuild with Vite:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This results in much faster build times than what we had with Webpack. In some cases, the build can be up to 87% faster.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;8. Ability to write CSS in the TypeScript file:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Although this is not recommended, and it is advised to keep a separate file for CSS:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Foajcn1logqu8qq40irq1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Foajcn1logqu8qq40irq1.png" alt="Image description" width="473" height="166"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Now, when we run ng new to create a new project, it will ask if we want it to be &lt;strong&gt;SSR&lt;/strong&gt;, as Angular always creates an SPA by default. So now, in the ng new process, it will no longer ask if we want to create the routes file; this will always be created automatically. Instead, it will now ask if we want an SSR (server-side render).&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Previously in Angular, we could also create an SSR by installing Angular Universal later, but now it is more convenient as the CLI does it during project creation.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;10. Custom inputs have been included in the transforms&lt;/strong&gt;, allowing us that when we already have a boolean property, we don’t need to specify if it is required to be equal to true; simply stating the name of the input assumes it will be true, helping to reduce code:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fplnlo8yycwo208u84237.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fplnlo8yycwo208u84237.png" alt="Image description" width="447" height="127"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjerbf56uar4ythkufpei.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjerbf56uar4ythkufpei.png" alt="Image description" width="252" height="93"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;11. The lifecycle of Angular has been extended with after render&lt;/strong&gt; and after next render, which can be executed on the client side.&lt;/p&gt;

&lt;p&gt;— Notes based on the Angular course by EfisioDev —&lt;/p&gt;

</description>
      <category>angular</category>
      <category>node</category>
      <category>javascript</category>
    </item>
    <item>
      <title>New Features in Angular 16: Signals and RxJS</title>
      <dc:creator>Samira Awad</dc:creator>
      <pubDate>Wed, 02 Oct 2024 03:55:10 +0000</pubDate>
      <link>https://dev.to/samirabawad/new-features-in-angular-16-signals-and-rxjs-ec5</link>
      <guid>https://dev.to/samirabawad/new-features-in-angular-16-signals-and-rxjs-ec5</guid>
      <description>&lt;p&gt;&lt;strong&gt;1) Signals vs RxJS: Creating a Signal variable from scratch in Angular 16 and comparing it to an Observable.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;With an example where we have a sidebar menu and a top menu, every time we press a button, the top menu will tell the sidebar menu to collapse:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F33wvrwatz708fduksluq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F33wvrwatz708fduksluq.png" alt="Image description" width="292" height="96"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;With RxJS:&lt;/p&gt;

&lt;p&gt;This communication is done in a service using a subject and an observable, where every time we click the button, a next is called, which passes the emitted value to the subscribed observable. The sidebar menu component will simply be subscribed and will use this property in the HTML. First, we create the Subject in the service, then we create the observable from it, and we call next to pass the emitted value:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdkwlm112lptabw2uk2km.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdkwlm112lptabw2uk2km.png" alt="Image description" width="321" height="167"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fiiuz1yy238d0w3hohv1t.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fiiuz1yy238d0w3hohv1t.png" alt="Image description" width="229" height="168"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fc3ztp9jxflkxbq8e5fro.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fc3ztp9jxflkxbq8e5fro.png" alt="Image description" width="305" height="123"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;With Signals:&lt;/p&gt;

&lt;p&gt;This can be done simply with Signals. Signals were created in Angular to achieve better performance in certain simpler cases. They are imported from @angular/core.&lt;/p&gt;

&lt;p&gt;You need to declare a Signal, and every time we update that signal, we call set on it. In the sidebar menu component, we just have to reference that property, and to use the signal in the HTML, we need to put parentheses around it to get its value, as this is how signals are used.&lt;/p&gt;

&lt;p&gt;We can also perform an update, which has the added benefit of telling us the previous value. For this, we specify that it receives the previous value and its type, and with an arrow function, we indicate the new value, which is the negated new value:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F30kvxnhqji2skekymo6f.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F30kvxnhqji2skekymo6f.png" alt="Image description" width="271" height="156"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ferxs60hmoq6mg3cjyc38.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ferxs60hmoq6mg3cjyc38.png" alt="Image description" width="278" height="89"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fruu7fpvhablggmsjcraj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fruu7fpvhablggmsjcraj.png" alt="Image description" width="330" height="130"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;There are also ways to convert observables to signals and signals to observables:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4mz041dr3lkidttzx8dv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4mz041dr3lkidttzx8dv.png" alt="Image description" width="263" height="44"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It's not that signals are a replacement for subjects, as both, along with observables, are much more powerful and have many more features, such as RxJS operators (we have much more control with RxJS). However, signals provide a simple way to work and are common with other libraries and frameworks.&lt;/p&gt;

&lt;p&gt;RxJS is a library from Microsoft, not Angular. In contrast, Signals is a library from Angular, which provides greater control and performance, as it allows Angular to know exactly which part has changed when a state changes. This avoids having to re-render the entire component, focusing only on that specific part.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2) New simplified way to unsubscribe with takeUntilDestroyed from RxJS in Angular 16.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In Angular, it's important to unsubscribe from observables. In an example, in OnInit, we store a subscription, and in OnDestroy, we unsubscribe.&lt;/p&gt;

&lt;p&gt;The old way was to store a variable with the subscription, and at the time of subscribing, save it in that variable and destroy that subscription in OnDestroy:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2dtj19fz2nb6r0qzppae.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2dtj19fz2nb6r0qzppae.png" alt="Image description" width="375" height="228"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Detailed Explanation: A property of type Subscription (from RxJS) is created. This property is initialized in ngOnInit, assigning it the reference of the subscription when it is made. Then, in ngOnDestroy, the subscription is canceled. If the component hasn't defined the subscription variable, it's necessary to handle the error, either by using a question mark to check if it is defined or through a conditional.&lt;/p&gt;

&lt;p&gt;Now, this can be done more simply, without creating OnDestroy or a subscription variable, by using the RxJS operator takeUntilDestroyed. What this does is automatically cancel the subscription when the component is about to be destroyed. It is important to inject the DestroyRef service and pass it, so it knows when the component is destroyed:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1iqyutc7pd50zy0bw9ih.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1iqyutc7pd50zy0bw9ih.png" alt="Image description" width="439" height="292"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Detailed Explanation: Now, in the case where we are not unsubscribing, we add an RxJS pipe and send it a takeUntilDestroyed(), a NEW operator, which requires us to pass a destroyedRef, which is a service (from @angular/core) that we can inject into the constructor.&lt;/p&gt;

&lt;p&gt;Example: In a sidebar service, it listens for a button click in the navbar component. With takeUntilDestroyed(), it unsubscribes only when the component is destroyed, avoiding multiple subscriptions. In this case, we always want to listen to whether the button has been pressed or not; therefore, we only want to unsubscribe if the component is destroyed.&lt;/p&gt;

&lt;p&gt;This is important to do, as otherwise, it will be listening even if we are in other components, and it will only unsubscribe if we close the app since the component is destroyed. This is crucial because if it is always active, when navigating through page components, for example, in the first navigation, it subscribes, then we navigate to another page, and when we return to the first page, it would be a second subscription, resulting in two active subscriptions. Thus, it is important to unsubscribe.&lt;/p&gt;

&lt;p&gt;An important note: when we subscribe to an HTTP request, it is not necessary to unsubscribe, as this is done automatically.&lt;/p&gt;

&lt;p&gt;3) Effect of a Signal in Angular. Listening for changes in a Signal.&lt;/p&gt;

&lt;p&gt;In an example, we have a Signal that returns a boolean and in a method below, it updates with an update:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fw9wnwgy944nsx9mlu1do.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fw9wnwgy944nsx9mlu1do.png" alt="Image description" width="298" height="233"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Imagine you want to be alerted whenever the signal changes, but it changes from many places, not just from this method. If we want to do something whenever it changes, we can do this with an effect. This function takes a signal and checks if it changes to automatically execute the method within the effect:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F29dhxe9tx6n32119v19k.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F29dhxe9tx6n32119v19k.png" alt="Image description" width="381" height="235"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;With this, for example, instead of a console log, we can save the value in local storage and instantiate it with that value. This is especially useful when working with code that we do not know and are unsure how many places it is being modified from.&lt;/p&gt;

&lt;p&gt;— Notes based on the Angular course from EfisioDev —&lt;/p&gt;

</description>
      <category>angular</category>
      <category>javascript</category>
      <category>node</category>
    </item>
    <item>
      <title>What's New in Angular 16: Inputs in Components</title>
      <dc:creator>Samira Awad</dc:creator>
      <pubDate>Wed, 02 Oct 2024 03:50:35 +0000</pubDate>
      <link>https://dev.to/samirabawad/whats-new-in-angular-16-inputs-in-components-35l2</link>
      <guid>https://dev.to/samirabawad/whats-new-in-angular-16-inputs-in-components-35l2</guid>
      <description>&lt;p&gt;&lt;strong&gt;1) Required Component Input from Angular 16.&lt;/strong&gt;&lt;br&gt;
Now a component can have a required Input.&lt;/p&gt;

&lt;p&gt;Imagine we have a component with an input called user and we want it to be mandatory, meaning it should always be present. To do this, we open and close curly brackets and set required to true:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fojklay9wrats2v6sp74a.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fojklay9wrats2v6sp74a.png" alt="Image description" width="406" height="86"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;By doing this, an error will appear if we try to use this component without passing its mandatory input. If we pass the input, it runs correctly:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fb4ntzbhjy81u9m8td8il.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fb4ntzbhjy81u9m8td8il.png" alt="Image description" width="434" height="58"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This simplifies development, especially in older projects, as it will be easy to detect which inputs are mandatory and which are not. In previous versions, you could only add validations to check if inputs existed.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2) Input Transformations in Components in Angular 16.&lt;/strong&gt;&lt;br&gt;
An input is used to pass information from a parent component to a child component. But sometimes we want to pass the information in a different way or format. From this version onward, we can transform our inputs very easily.&lt;/p&gt;

&lt;p&gt;Imagine we have a component with an input called stock. We want that when the stock is null, instead of appearing as null, it shows 0. In other words, we want to make a small transformation.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;app-available-stock [stock]="null" /&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the past, we could only do this with a setter, but it was cumbersome as we had to create a setter and then a separate variable to display the data:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fets2dklymoxizn1z13vr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fets2dklymoxizn1z13vr.png" alt="Image description" width="441" height="156"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F61t4h1z0yff06g6rxdyu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F61t4h1z0yff06g6rxdyu.png" alt="Image description" width="414" height="70"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now, within an input, we can set the transform property and use a function to handle the transformation:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fknqcjf88m4il8lqsezel.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fknqcjf88m4il8lqsezel.png" alt="Image description" width="466" height="271"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now, the transformation happens inside the object brackets within the input. We set transform and pass a function to it. For the example, we declare the transformation function above, but in practice, we can create a file or something similar. In the component’s HTML, we directly call the stock variable: &lt;code&gt;{{stock}}&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3) Extract URL Parameters Using Inputs, Without ActivatedRoute, in Angular 16.&lt;/strong&gt;&lt;br&gt;
Before, the only way we had to obtain a route parameter was with ActivatedRoute. In the example, the parameter is called id, and the service is injected and used:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpst84givnl1tdzcabt0j.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpst84givnl1tdzcabt0j.png" alt="Image description" width="156" height="39"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjua7jzjenwk9tacjcutr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjua7jzjenwk9tacjcutr.png" alt="Image description" width="371" height="90"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flnvd7iinhhbq4o2uzidt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flnvd7iinhhbq4o2uzidt.png" alt="Image description" width="341" height="118"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;However, now we can also do this with inputs, simply by creating an input that has the same name as the route parameter, and its property is retrieved. To make this work, we need to have it configured in the provideRouter in appConfig: &lt;code&gt;withComponentInputBinding()&lt;/code&gt;:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fk3rxcytxpvq2gnaicyek.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fk3rxcytxpvq2gnaicyek.png" alt="Image description" width="354" height="135"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzitey2zbvzajpoq9nx78.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzitey2zbvzajpoq9nx78.png" alt="Image description" width="367" height="85"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This new approach avoids the need to inject the service.&lt;/p&gt;

&lt;p&gt;— Notes based on the Angular course from EfisioDev —&lt;/p&gt;

</description>
      <category>angular</category>
      <category>javascript</category>
      <category>node</category>
    </item>
    <item>
      <title>What's New in Angular 16: Inputs in Components</title>
      <dc:creator>Samira Awad</dc:creator>
      <pubDate>Wed, 02 Oct 2024 03:50:33 +0000</pubDate>
      <link>https://dev.to/samirabawad/whats-new-in-angular-16-inputs-in-components-3f82</link>
      <guid>https://dev.to/samirabawad/whats-new-in-angular-16-inputs-in-components-3f82</guid>
      <description>&lt;p&gt;&lt;strong&gt;1) Required Component Input from Angular 16.&lt;/strong&gt;&lt;br&gt;
Now a component can have a required Input.&lt;/p&gt;

&lt;p&gt;Imagine we have a component with an input called user and we want it to be mandatory, meaning it should always be present. To do this, we open and close curly brackets and set required to true:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fojklay9wrats2v6sp74a.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fojklay9wrats2v6sp74a.png" alt="Image description" width="406" height="86"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;By doing this, an error will appear if we try to use this component without passing its mandatory input. If we pass the input, it runs correctly:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fb4ntzbhjy81u9m8td8il.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fb4ntzbhjy81u9m8td8il.png" alt="Image description" width="434" height="58"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This simplifies development, especially in older projects, as it will be easy to detect which inputs are mandatory and which are not. In previous versions, you could only add validations to check if inputs existed.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2) Input Transformations in Components in Angular 16.&lt;/strong&gt;&lt;br&gt;
An input is used to pass information from a parent component to a child component. But sometimes we want to pass the information in a different way or format. From this version onward, we can transform our inputs very easily.&lt;/p&gt;

&lt;p&gt;Imagine we have a component with an input called stock. We want that when the stock is null, instead of appearing as null, it shows 0. In other words, we want to make a small transformation.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;app-available-stock [stock]="null" /&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the past, we could only do this with a setter, but it was cumbersome as we had to create a setter and then a separate variable to display the data:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fets2dklymoxizn1z13vr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fets2dklymoxizn1z13vr.png" alt="Image description" width="441" height="156"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F61t4h1z0yff06g6rxdyu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F61t4h1z0yff06g6rxdyu.png" alt="Image description" width="414" height="70"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now, within an input, we can set the transform property and use a function to handle the transformation:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fknqcjf88m4il8lqsezel.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fknqcjf88m4il8lqsezel.png" alt="Image description" width="466" height="271"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now, the transformation happens inside the object brackets within the input. We set transform and pass a function to it. For the example, we declare the transformation function above, but in practice, we can create a file or something similar. In the component’s HTML, we directly call the stock variable: &lt;code&gt;{{stock}}&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3) Extract URL Parameters Using Inputs, Without ActivatedRoute, in Angular 16.&lt;/strong&gt;&lt;br&gt;
Before, the only way we had to obtain a route parameter was with ActivatedRoute. In the example, the parameter is called id, and the service is injected and used:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpst84givnl1tdzcabt0j.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpst84givnl1tdzcabt0j.png" alt="Image description" width="156" height="39"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjua7jzjenwk9tacjcutr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjua7jzjenwk9tacjcutr.png" alt="Image description" width="371" height="90"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flnvd7iinhhbq4o2uzidt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flnvd7iinhhbq4o2uzidt.png" alt="Image description" width="341" height="118"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;However, now we can also do this with inputs, simply by creating an input that has the same name as the route parameter, and its property is retrieved. To make this work, we need to have it configured in the provideRouter in appConfig: &lt;code&gt;withComponentInputBinding()&lt;/code&gt;:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fk3rxcytxpvq2gnaicyek.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fk3rxcytxpvq2gnaicyek.png" alt="Image description" width="354" height="135"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzitey2zbvzajpoq9nx78.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzitey2zbvzajpoq9nx78.png" alt="Image description" width="367" height="85"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This new approach avoids the need to inject the service.&lt;/p&gt;

&lt;p&gt;— Notes based on the Angular course from EfisioDev —&lt;/p&gt;

</description>
      <category>angular</category>
      <category>javascript</category>
      <category>node</category>
    </item>
    <item>
      <title>Improve performance in Angular by creating your CUSTOM PIPES</title>
      <dc:creator>Samira Awad</dc:creator>
      <pubDate>Wed, 02 Oct 2024 03:39:23 +0000</pubDate>
      <link>https://dev.to/samirabawad/improve-performance-in-angular-by-creating-your-custom-pipes-3gaj</link>
      <guid>https://dev.to/samirabawad/improve-performance-in-angular-by-creating-your-custom-pipes-3gaj</guid>
      <description>&lt;p&gt;We should not use methods in the HTML unless they are associated with events:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fifrn6o8i3enlabupgl77.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fifrn6o8i3enlabupgl77.png" alt="Image description" width="398" height="100"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This has the problem of being executed multiple times. In the example, an array is being mapped, which will execute 16 times. Similarly, we should not use get or API requests directly.&lt;/p&gt;

&lt;p&gt;This can be solved using a pipe and/or creating a custom pipe, which will only execute once for each user. In this example, the pipe has a transform method that receives the same arguments as the previously used method:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyliuhpkqopx9v4dwb8d7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyliuhpkqopx9v4dwb8d7.png" alt="Image description" width="374" height="97"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkpw5hn0funjtsqm5nyt1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkpw5hn0funjtsqm5nyt1.png" alt="Image description" width="446" height="107"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Explanation:&lt;/p&gt;

&lt;p&gt;The problem with methods arises because they are not native to Angular, so Angular doesn't know when their value has changed. As a result, it keeps constantly evaluating methods for changes after every small update.&lt;/p&gt;

&lt;p&gt;In contrast, a pipe is native, pure, and only executes when its arguments change. Additionally, a pipe can be reused in different parts of the application (unlike a method, which can only be reused by sending it to a service).&lt;/p&gt;

&lt;p&gt;We can create a pipe if it doesn’t exist by specifying its target location:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;ng g p pipes/fullName&lt;/code&gt; (where pipes/fullName is the location).&lt;/p&gt;

&lt;p&gt;The pipe is created as a class that implements PipeTransform, an interface that requires us to have a transform method. This method is executed when the pipe runs and works just like a normal method. To use the created pipe, we must import it into the app component (standalone):&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxxsdnaet52i1j90sa1gu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxxsdnaet52i1j90sa1gu.png" alt="Image description" width="327" height="109"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When using it in the HTML, we call it by the name indicated in the name field of the pipe, using the ‘|’ symbol followed by the pipe’s name. The first argument is passed to the left, and if we want to pass other arguments, they are passed to the right, after a colon ‘:’:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcjy1j1c34kbqbyjq4c85.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcjy1j1c34kbqbyjq4c85.png" alt="Image description" width="358" height="162"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fomruxps2xy3bd0xakgtr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fomruxps2xy3bd0xakgtr.png" alt="Image description" width="372" height="79"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Remember good practices: if there are many arguments, it's better to use an object. As a good practice, try not to overuse pipes to avoid cluttering. Break down the code and you’ll succeed.&lt;/p&gt;

&lt;p&gt;To create the pipe's content, we specify the arguments we want to receive and the return type in the transform method. Then, we write the content and return the result. Optional values can be received by prefixing them with a ‘?’, and default values can be assigned using ‘=’.&lt;/p&gt;

&lt;p&gt;— Notes based on EfisioDev’s Angular course —&lt;/p&gt;

</description>
      <category>angular</category>
      <category>node</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Improvements in Angular 14 and 15</title>
      <dc:creator>Samira Awad</dc:creator>
      <pubDate>Wed, 02 Oct 2024 03:34:42 +0000</pubDate>
      <link>https://dev.to/samirabawad/improvements-in-angular-14-and-15-1f04</link>
      <guid>https://dev.to/samirabawad/improvements-in-angular-14-and-15-1f04</guid>
      <description>&lt;p&gt;&lt;strong&gt;1) Inject Services in Angular 14 Without a Constructor Using inject.&lt;/strong&gt;&lt;br&gt;
Previously, a class with a constructor was always required to inject any service:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class MyClass {
  constructor(private myService: MyService) {}
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, we can inject a service in both functions and classes. We just need to declare a variable and set it equal to inject with the service name inside:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;const myService = inject(MyService);&lt;/code&gt;&lt;br&gt;
This is useful, for example, in interceptors and guards, which are now commonly done with functions instead of classes.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2) Self-Closing Tag to Save Lines in Angular 15.&lt;/strong&gt;&lt;br&gt;
Starting with this version, you can use a component with a single tag:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&amp;lt;my-component /&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Before, it was necessary to open and close a component tag to use it:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&amp;lt;my-component&amp;gt;&amp;lt;/my-component&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3) Reduce Your Imports in Angular by Creating Shortcuts.&lt;/strong&gt;&lt;br&gt;
Instead of having long imports like these:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;import { MyComponent } from '../../components/my-component';&lt;/code&gt;&lt;br&gt;
You can shorten imports like this:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;import { MyComponent } from '@components/my-component';&lt;br&gt;
&lt;/code&gt;To achieve this, go to the tsconfig.json file and add paths under the compilerOptions property. Inside paths, you can configure your own import shortcuts:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
  "compilerOptions": {
    "paths": {
      "@components/*": ["src/app/components/*"]
    }
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The recommendation is that if you’re within a component and want to use something specific to that component, import it relatively using ./ to access that resource. But when accessing a parent folder, use the @ shortcut. If it gives you issues, you may need to close and reopen Visual Studio Code. These small details make a difference in keeping the code as organized as possible.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4) Optimize Image Loading with the NgOptimizedImage Directive in Angular 15.&lt;/strong&gt;&lt;br&gt;
If we have a list with 15 images and iterate through them normally using [src], we’ll face the issue of loading all 15 images at once when the application starts, which reduces performance:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&amp;lt;img [src]="imageUrl" /&amp;gt;&lt;/code&gt;&lt;br&gt;
To fix this, Angular provides the NgOptimizedImage directive. To use it, just import it:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;import { NgOptimizedImage } from '@angular/common';&lt;/code&gt;&lt;br&gt;
And use [ngSrc] instead of [src]. This will load images lazily, improving performance. However, the directive has many other configurations. If you only want lazy loading, I recommend using the loading="lazy" attribute, which is part of the HTML standard and is compatible with all browsers:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&amp;lt;img [ngSrc]="imageUrl" loading="lazy" /&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;A recommendation: if you have a main image at the top of the menu, do not set it to lazy loading, as it will be the first to load when the app opens. Apply this only to images that might appear below the scroll, as we don’t need them to load right away.&lt;/p&gt;

&lt;p&gt;This is very important for public applications, such as SSR apps that need good SEO, as it helps improve performance.&lt;/p&gt;

&lt;p&gt;— Notes based on the Angular course by EfisioDev —&lt;/p&gt;

</description>
      <category>angular</category>
      <category>node</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Changing the Angular CLI version</title>
      <dc:creator>Samira Awad</dc:creator>
      <pubDate>Wed, 02 Oct 2024 03:25:34 +0000</pubDate>
      <link>https://dev.to/samirabawad/changing-the-angular-cli-version-1k34</link>
      <guid>https://dev.to/samirabawad/changing-the-angular-cli-version-1k34</guid>
      <description>&lt;p&gt;Angular is constantly updating its versions, every 6 months. There are two ways to make the change: using the Node.js version manager or via command line.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;a) Via Command Line:&lt;/strong&gt;&lt;br&gt;
First, check the Angular version you are using with: &lt;code&gt;ng serve&lt;/code&gt;. Then, open the terminal in administrator mode and uninstall the current version: &lt;code&gt;npm uninstall -g @angular/cli&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Now, verify that the cache is correct: npm cache verify. If there’s no error, proceed; otherwise, clear the cache with: &lt;code&gt;npm cache clean --force&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Next, install the desired version (in this case, version 16 which installs the most stable version): &lt;code&gt;npm install -g @angular/cli@16&lt;/code&gt;. Verify the installation with: &lt;code&gt;ng version&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;b) Via NVM:&lt;/strong&gt;&lt;br&gt;
Select the version of Node.js to use and install the compatible Angular version with: &lt;code&gt;npm install -g @angular/cli@12.2.8&lt;/code&gt;. Uninstall de Angular version with:&lt;code&gt;npm uninstall -g @angular/cli@12.2.8&lt;/code&gt;. The Angular version will be install only in the Node current version.&lt;br&gt;
Note: The LTS (Long Term Support) version of Node.js is the stable version and is recommended for most production projects as it receives support and security updates.&lt;/p&gt;

&lt;p&gt;We can install a different version of angular for each version of node. This will install only on our used node version.&lt;/p&gt;

&lt;p&gt;To see the angular version of the node version used, in a cmd WITHOUT ADMINISTRATOR PERMISSIONS, execute &lt;code&gt;ng version&lt;/code&gt;.  It is important to do this in another cmd to check the versions, since in the administrator permissions console, it will not send the correct data.&lt;/p&gt;

&lt;p&gt;And to uninstall we use the command: &lt;code&gt;npm install -g @angular/cli&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Check compatibilities at: &lt;a href="https://angular.dev/reference/versions" rel="noopener noreferrer"&gt;https://angular.dev/reference/versions&lt;/a&gt;&lt;/p&gt;

</description>
      <category>angular</category>
      <category>node</category>
      <category>javascript</category>
      <category>nvm</category>
    </item>
    <item>
      <title>Node.js version</title>
      <dc:creator>Samira Awad</dc:creator>
      <pubDate>Wed, 02 Oct 2024 03:22:08 +0000</pubDate>
      <link>https://dev.to/samirabawad/nodejs-version-3dha</link>
      <guid>https://dev.to/samirabawad/nodejs-version-3dha</guid>
      <description>&lt;p&gt;It’s crucial to use the correct Node.js version for our project, otherwise, we may encounter issues with unit tests or application deployment.&lt;/p&gt;

&lt;p&gt;First, we check the Node.js version in use by running: &lt;code&gt;ng serve&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;This command will display the versions of Angular, Node.js, OS, and npm. If Node.js is not the correct version, it will show &lt;strong&gt;(Unsupported)&lt;/strong&gt; next to it.&lt;/p&gt;

&lt;p&gt;By visiting the Angular website, we can view the compatibility between Node.js and different Angular versions. To switch versions, we can either use the Node.js version manager or the command line.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;a) Via the Command Line:&lt;/strong&gt;&lt;br&gt;
First, uninstall the current version of Node.js. Then, go to the official Node.js website, find previous versions, and install the compatible one. Click on "Released" and download the version for your OS.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;b) Via Node Version Manager (nvm):&lt;/strong&gt;&lt;br&gt;
Every programming language has its own version manager. For Node.js, we use NVM (Node Version Manager), which allows us to work with multiple versions of Node.js in the same environment. This is useful for testing our development in different Node.js versions, a best practice recommended by both npm and Microsoft.&lt;/p&gt;

&lt;p&gt;With NVM, you can easily manage multiple Node.js versions on the same system, allowing you to test different environments without hassle.&lt;/p&gt;

&lt;p&gt;Before installing NVM, make sure there’s no previous version of Node.js installed on your system to avoid conflicts: &lt;code&gt;node -v&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Installing NVM:&lt;/strong&gt; For macOS and Linux, visit the official NVM repository on GitHub (nvm-sh/nvm). For Windows, download from this link: NVM repository for Windows.&lt;/p&gt;

&lt;p&gt;Click on "Download Now," download the nvm-setup.zip file, unzip it, and run the installer. During installation, keep all default options since NVM includes an update tool that makes version management easy.&lt;/p&gt;

&lt;p&gt;Verify the installation by running: &lt;code&gt;nvm&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;NVM:&lt;br&gt;
NVM allows you to install specific Node.js versions or the latest one.&lt;/p&gt;

&lt;p&gt;To install the latest recommended version (LTS): &lt;code&gt;nvm install lts&lt;/code&gt;. To install a different version: &lt;code&gt;nvm install version&lt;/code&gt;.&lt;br&gt;
To view the installed Node.js versions on your system: &lt;code&gt;nvm list&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Use a specific Node.js version: Open a terminal with administrator privileges and select the desired Node.js version: &lt;br&gt;
&lt;code&gt;nvm use 16.13.1&lt;/code&gt; (Replace 16.13.1 with your desired version).&lt;/p&gt;

&lt;p&gt;To verify the active Node.js version: &lt;code&gt;node -v&lt;/code&gt;. You can also check the current version in use with: &lt;code&gt;nvm current&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;If you want to uninstall a specific Node.js version, open the terminal with administrator privileges: &lt;code&gt;nvm uninstall 16.13.1&lt;/code&gt;&lt;br&gt;
(Replace 16.13.1 with your desired version).&lt;/p&gt;

&lt;p&gt;Installing NPM and Yarn:&lt;br&gt;
When you install Node.js using NVM, npm is automatically installed. To verify the npm version: &lt;code&gt;npm -v&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;If you prefer using Yarn, install it for each version of Node.js you use: &lt;code&gt;npm install -g yarn&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;— Notes based on the Angular course by EfisioDev —&lt;/p&gt;

</description>
      <category>node</category>
      <category>javascript</category>
      <category>frontend</category>
      <category>angular</category>
    </item>
    <item>
      <title>How to install Node.js, NPM and NVM on Windows (node version manager)</title>
      <dc:creator>Samira Awad</dc:creator>
      <pubDate>Thu, 29 Aug 2024 01:02:24 +0000</pubDate>
      <link>https://dev.to/samirabawad/how-to-install-nodejs-npm-and-nvm-on-windows-node-version-manager-9j9</link>
      <guid>https://dev.to/samirabawad/how-to-install-nodejs-npm-and-nvm-on-windows-node-version-manager-9j9</guid>
      <description>&lt;p&gt;&lt;strong&gt;1. Introduction:&lt;/strong&gt;&lt;br&gt;
Each language has its own version manager. For Node.js, we use NVM (Node Version Manager), which allows us to work with multiple versions of Node.js in the same environment. This is useful for testing our developments on different versions of Node.js, which is a good practice recommended by both npm and Microsoft.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Key Concepts:&lt;/strong&gt;&lt;br&gt;
• &lt;strong&gt;NPM:&lt;/strong&gt; Node.js Package Manager.&lt;br&gt;
• &lt;strong&gt;NVM:&lt;/strong&gt; Node.js Version Manager.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Preparations:&lt;/strong&gt;&lt;br&gt;
Before installing NVM, we must ensure that there is no previous version of Node.js installed on our system to avoid conflicts. To check this, run in the terminal:&lt;br&gt;
&lt;code&gt;node -v&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. NVM installation:&lt;/strong&gt;&lt;br&gt;
• For macOS and Linux: Visit the official NVM repository on GitHub (nvm-sh/nvm).&lt;br&gt;
• For Windows: Download NVM from the following link:&lt;br&gt;
&lt;a href="https://github.com/coreybutler/nvm-windows" rel="noopener noreferrer"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Click "Download Now".&lt;/li&gt;
&lt;li&gt;Download the nvm-setup.zip file.&lt;/li&gt;
&lt;li&gt;Unzip the file and run the installer.&lt;/li&gt;
&lt;li&gt;During installation, leave all the default options, since NVM has an update tool that will allow us to easily manage versions.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;5.Verify NVM installation:&lt;/strong&gt;&lt;br&gt;
Once installed, open a new terminal and verify that NVM is correctly installed by running:&lt;br&gt;
&lt;code&gt;nvm&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;6.Install a version of Node.js:&lt;/strong&gt;&lt;br&gt;
NVM allows you to install specific versions of Node.js or the latest version. To install the latest recommended version (LTS), run:&lt;br&gt;
&lt;code&gt;nvm install lts&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;To install others:  nvm install version&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;7.List installed versions of Node.js:&lt;/strong&gt;&lt;br&gt;
To view the versions of Node.js installed on your system, use:&lt;br&gt;
&lt;code&gt;nvm list&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;8.Use a specific version of Node.js:&lt;/strong&gt;&lt;br&gt;
Open a terminal with administrator permissions and choose the version of Node.js you want to use:&lt;br&gt;
&lt;code&gt;nvm use 16.13.1&lt;/code&gt;&lt;br&gt;
(Replace 16.13.1 with the version you want.)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;9.Check the version of Node.js in use:&lt;/strong&gt;&lt;br&gt;
To check which version of Node.js is active, run:&lt;br&gt;
&lt;code&gt;node -v&lt;/code&gt;&lt;br&gt;
You can also check the current version of Node.js handled by NVM with:&lt;br&gt;
&lt;code&gt;nvm current&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;10.Uninstall a version of Node.js:&lt;/strong&gt;&lt;br&gt;
If you want to uninstall a version of Node.js, open the terminal with administrator permissions and run:&lt;br&gt;
&lt;code&gt;nvm uninstall 16.13.1&lt;/code&gt;&lt;br&gt;
(Replace 16.13.1 with the version you want to remove.)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;11.Installing NPM and Yarn:&lt;/strong&gt;&lt;br&gt;
When you install Node.js with NVM, npm is installed automatically. To check the npm version, use:&lt;br&gt;
&lt;code&gt;npm -v&lt;/code&gt;&lt;br&gt;
If you prefer to use Yarn, install it for each version of Node.js you use:&lt;br&gt;
&lt;code&gt;npm install -g yarn&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Conclusion:&lt;/strong&gt;&lt;br&gt;
With NVM, you can easily manage multiple versions of Node.js on a single system, allowing you to easily test in different environments.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fi8jlewwy0dy790q3r9vu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fi8jlewwy0dy790q3r9vu.png" alt="Image description" width="800" height="408"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>node</category>
      <category>npm</category>
      <category>nvm</category>
      <category>javascript</category>
    </item>
  </channel>
</rss>
