<?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: Chandan Bangalore</title>
    <description>The latest articles on DEV Community by Chandan Bangalore (@chandanbsd).</description>
    <link>https://dev.to/chandanbsd</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%2F557342%2F3394f0ff-14ed-47e5-8f73-11d47d8aaffa.jpeg</url>
      <title>DEV Community: Chandan Bangalore</title>
      <link>https://dev.to/chandanbsd</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/chandanbsd"/>
    <language>en</language>
    <item>
      <title>Connecting Postgres to ASP.NET Core Web Api with EF Core and .NET Aspire</title>
      <dc:creator>Chandan Bangalore</dc:creator>
      <pubDate>Mon, 03 Mar 2025 06:21:39 +0000</pubDate>
      <link>https://dev.to/chandanbsd/connecting-postgres-to-aspnet-core-web-api-with-ef-core-and-net-aspire-4he5</link>
      <guid>https://dev.to/chandanbsd/connecting-postgres-to-aspnet-core-web-api-with-ef-core-and-net-aspire-4he5</guid>
      <description>&lt;h2&gt;
  
  
  Introduction:
&lt;/h2&gt;

&lt;p&gt;The introduction of .NET Aspire is a significant improvement that enables developers to define and deploy infrastructure and connect them across resources. The following post will demonstrate the use case for connecting PostgreSQL to an ASP.NET Core Web API.&lt;/p&gt;

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

&lt;ul&gt;
&lt;li&gt;ASP.NET Core SDK 9 (&lt;a href="https://dotnet.microsoft.com/en-us/download" rel="noopener noreferrer"&gt;.NET 9&lt;/a&gt;) or above.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://visualstudio.microsoft.com/vs/" rel="noopener noreferrer"&gt;Visual Studio 2022&lt;/a&gt; or any other text editor.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://docs.docker.com/engine/" rel="noopener noreferrer"&gt;Docker Engine&lt;/a&gt; (MacOS, Linux) or &lt;a href="https://www.docker.com/products/docker-desktop/" rel="noopener noreferrer"&gt;Docker Desktop&lt;/a&gt; (MacOS, Linux, Windows) or &lt;a href="https://podman.io/" rel="noopener noreferrer"&gt;podman&lt;/a&gt;(MacOS, Linux, Windows) or &lt;a href="https://podman-desktop.io/" rel="noopener noreferrer"&gt;podman desktop&lt;/a&gt; (macos, Linux, Windows)&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Background:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://learn.microsoft.com/en-us/dotnet/aspire/get-started/aspire-overview" rel="noopener noreferrer"&gt;.NET Aspire&lt;/a&gt;: Highly opinionated first party set of implementations.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://www.postgresql.org/" rel="noopener noreferrer"&gt;Postgres&lt;/a&gt;: An open source and very popular relational database management server.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://dotnet.microsoft.com/en-us/apps/aspnet" rel="noopener noreferrer"&gt;ASP.NET Core&lt;/a&gt;: A popular open source framework for building web applications and REST API's.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://learn.microsoft.com/en-us/ef/core/" rel="noopener noreferrer"&gt;EF Core&lt;/a&gt;: An ORM (Object Relational Mapper); At a fundamental level, it enables interactions with the database server with C#.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Let's get started;&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 1: Create an empty aspire application
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Instruction for Visual Studio:&lt;/strong&gt; &lt;br&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%2Fgnl08j10xu8pz0fjwi4r.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%2Fgnl08j10xu8pz0fjwi4r.png" alt=".NET Aspire VS Template" width="800" height="68"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Instruction for CLI:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;dotnet new install Aspire.ProjectTemplates
dotnet new list aspire
&lt;/code&gt;&lt;/pre&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%2Fvr4q09248bkpjb8uh9ep.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%2Fvr4q09248bkpjb8uh9ep.png" alt="List of CLI templates" width="800" height="163"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Use the command below to create the project.&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;dotnet new aspire -o &amp;lt;ProjectName&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You will see two different projects - The AppHost and Service Defaults.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;AppHost.csproj&lt;/code&gt;: Loosely think of this as the project that manages all other projects in the entire application. It utilizes the &lt;code&gt;DistributedApplication&lt;/code&gt; Class from the &lt;code&gt;Aspire.Hosting&lt;/code&gt; package to create resources and connect them to other projects.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;ServiceDefaults.csproj&lt;/code&gt;: These are highly opinionated extension methods written by Microsoft that follow best practices for configuring various everyday use cases in an application (e.g., Adding logging, health checks, etc.).&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Step 2: Add the ASP.Net Core Web Api to the created solution
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Instruction for Visual Studio:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Select the ASP.NET Core Web API template
&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%2Ftg5qve8qh5s9y5gqs69g.png" alt="VS ASP.NET template menu option" width="800" height="68"&gt;
&lt;/li&gt;
&lt;li&gt;Additionally, ensure that the Enlist in .NET Aspire Orchestration checkbox is selected. The container support checkbox may be left unselected.
&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%2Fhv1pqwimfeas69vytgjo.png" alt="VS ASP.NET template menu selection" width="800" height="525"&gt;
&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;p&gt;&lt;strong&gt;Instruction for CLI&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;pre class="highlight plaintext"&gt;&lt;code&gt;dotnet new webapi -o &amp;lt;ProjectName&amp;gt;
dotnet sln add &amp;lt;ProjectName&amp;gt;
&lt;/code&gt;&lt;/pre&gt;




&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;The final project structure will look something like this:&lt;br&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%2Fzfincy61z6wotn7pf2ce.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%2Fzfincy61z6wotn7pf2ce.png" alt="Final project structure" width="407" height="410"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Feel free to update NuGet packages for all projects in the solution.&lt;/p&gt;
&lt;h3&gt;
  
  
  Step 3: Connecting the WEB Api to the .NET Aspire App Host
&lt;/h3&gt;

&lt;p&gt;The AppHost project from aspire provides the &lt;code&gt;DistributedApplication&lt;/code&gt; builder class, which allows us to orchestrate the creation of resources and startup of any project.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Step 3(a): Inside the Aspire AppHost project, add a reference to the  ASP.NET Web API project (here called &lt;code&gt;ExampleApp.Web&lt;/code&gt;).&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Instructions for Visual Studio

&lt;ul&gt;
&lt;li&gt;Right click on the AppHost project and navigate to the built-in reference manager
&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%2Fpjt9pjovzwhzr85sembc.png" alt="Visual Studio 2022 Reference Manager Navigation" width="800" height="785"&gt;
&lt;/li&gt;
&lt;li&gt;Mark the checkbox next to the Web Api project and click on 'OK' 
&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%2Fezttjdcii7sssv8uofew.png" alt="Visual Studio 2022 Reference Manager Navigation" width="800" height="555"&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Instruction for CLI:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Change working directory to the AppHost project folder (&lt;code&gt;cd &amp;lt;PATH_TO_APP_HOST_PROJECT&amp;gt;&lt;/code&gt;)
&lt;/li&gt;
&lt;/ul&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cd ExampleApp.AppHost
&lt;/code&gt;&lt;/pre&gt;


&lt;ul&gt;
&lt;li&gt;Now add a reference to the Web Api project using &lt;code&gt;dotnet add reference &amp;lt;PATH_TO_WEB_PROJECT&amp;gt;&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In my case that would be:&lt;br&gt;
&lt;/p&gt;

&lt;pre class="highlight plaintext"&gt;&lt;code&gt;dotnet add reference ..\&amp;lt;ProjectName&amp;gt;.Web
&lt;/code&gt;&lt;/pre&gt;




&lt;/li&gt;

&lt;/ul&gt;

&lt;/li&gt;

&lt;li&gt;&lt;p&gt;&lt;strong&gt;Step 3(b): Register the Web API project and trigger its startup inside AppHost&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;Original ExampleApp\ExampleApp.AppHost\Program.cs&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var builder = DistributedApplication.CreateBuilder(args);

builder.Build().Run();
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;Updated ExampleApp\ExampleApp.AppHost\Program.cs&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
var builder = DistributedApplication.CreateBuilder(args);

builder.AddProject&amp;lt;Projects.Example_Web&amp;gt;("web");

builder.Build().Run();
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 4: Configure Web Api project to use the service defaults
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Step 4(a): Inside the API project add a reference to the ServiceDefaults project&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This step is very similar to step 3(a)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Instructions for CLI:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;From inside the solution folder, change working directory to the web API project&lt;/p&gt;

&lt;p&gt;&lt;code&gt;cd ExampleProject.Web&lt;/code&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Add the reference&lt;/p&gt;

&lt;p&gt;&lt;code&gt;dotnet add reference ..\ExampleProject.ServiceDefaults&lt;/code&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;&lt;p&gt;&lt;strong&gt;Step 4(b): Invoke the extensions from the web API project.&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;Modify &lt;code&gt;ExampleApp.Web\Program.cs&lt;/code&gt; to include the following line.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;builder.AddServiceDefaults()&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Finally, when running the AppHost project, we should see the following:&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%2Fodirv9nx565so0j33hla.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%2Fodirv9nx565so0j33hla.png" alt="Aspire Dashboard" width="800" height="152"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;h3&gt;
  
  
  Step 5: Add the postgres server and database and integrate them.
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Step 5(a): First add the PostgreSQL hosting NuGet package to the AppHost project.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Using VS Code NuGet Package Manager
&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%2Flo4vt52jxgkjtgioz4ym.png" alt="NuGet GUI in VS" width="800" height="331"&gt;
&lt;/li&gt;
&lt;li&gt;Using CLI command: &lt;code&gt;dotnet add package Aspire.Hosting.PostgreSQL&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;&lt;p&gt;Step 5(b): Create the PostgreSQL server and the example database&lt;br&gt;&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;

&lt;/ul&gt;

&lt;pre class="highlight plaintext"&gt;&lt;code&gt; var postgresServer = builder.AddPostgres("postgreSQLServer");

 var exampleDatabase = postgresServer.AddDatabase("exampleDB");
&lt;/code&gt;&lt;/pre&gt;



&lt;p&gt;Optionally, you may include pgadmin to manage the database, as shown below.&lt;br&gt;
&lt;/p&gt;

&lt;pre class="highlight plaintext"&gt;&lt;code&gt; var postgresServer = builder.AddPostgres("postgreSQLServer")
                             .WithPgAdmin();

 var exampleDatabase = postgresServer.AddDatabase("exampleDB");
&lt;/code&gt;&lt;/pre&gt;



&lt;ul&gt;
&lt;li&gt; Step 5(c): Add a reference for the database to the web project.
&lt;/li&gt;
&lt;/ul&gt;

&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  builder.AddProject&amp;lt;Projects.ExampleApp_Web&amp;gt;("web")
.WithReference(exampleDatabase);
&lt;/code&gt;&lt;/pre&gt;




&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;The final &lt;code&gt;program.cs&lt;/code&gt; should be as below.&lt;/p&gt;

&lt;p&gt;ExampleApp\ExampleApp.AppHost\Program.cs&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var builder = DistributedApplication.CreateBuilder(args);


var postgresServer = builder.AddPostgres("postgreSQLServer").WithPgAdmin();

var exampleDatabase = postgresServer.AddDatabase("exampleDB");

builder.AddProject&amp;lt;Projects.ExampleApp_Web&amp;gt;("web")
    .WithReference(exampleDatabase);

builder.Build().Run();
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;### Step 6: Configure the web project to use the PostgreSQL database.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The next step may depend on the level of customization you require. For the scope of this blog, let's take the most straightforward approach.&lt;/p&gt;

&lt;p&gt;The next step may depend on the level of customization you require. For the scope of this blog, let's take the most straightforward approach.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Without EFCore:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Add the &lt;code&gt;Aspire.Npgsql&lt;/code&gt; nuget package to the web project&lt;/p&gt;

&lt;p&gt;&lt;code&gt;dotnet add package Aspire.Npgsql&lt;/code&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Modify the &lt;code&gt;ExampleApp\ExampleApp.Web\Program.cs&lt;/code&gt; to include&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;builder.AddNpgsqlDataSource("&amp;lt;POSTGRES_DATABASE_NAME&amp;gt;");
&lt;/code&gt;&lt;/pre&gt;


&lt;p&gt;For my example this would be &lt;code&gt;builder.AddNpgsqlDataSource('exampleDB');&lt;/code&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;With EFCore:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Add the &lt;code&gt;Aspire.Npgsql.EntityFrameworkCore.PostgreSQL&lt;/code&gt; nuget package to the web project
&lt;code&gt;dotnet add package Aspire.Npgsql.EntityFrameworkCore.PostgreSQL&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  builder.AddNpgsqlDbContext&amp;lt;YourDbContext&amp;gt;(connectionName: "&amp;lt;DATABASE_NAME&amp;gt;");
&lt;/code&gt;&lt;/pre&gt;



&lt;ul&gt;
&lt;li&gt;For my example this would be &lt;code&gt;builder.AddNpgsqlDbContext&amp;lt;ENTER_DB_CONTEXT_CLASS&amp;gt;(connectionName: "exampleDB");&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Note: I have not shown the creation of DB Context here to keep the blog succinct. Furthermore, using EFCore world may also require you to add &lt;a href="https://www.nuget.org/packages/microsoft.entityframeworkcore" rel="noopener noreferrer"&gt;Microsoft.EntityFrameworkCore&lt;/a&gt; and &lt;a href="https://www.nuget.org/packages/Npgsql.EntityFrameworkCore.PostgreSQL" rel="noopener noreferrer"&gt;Npgsql.EntityFrameworkCore.PostgreSQL&lt;/a&gt;  NuGet packages depending on your needs.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;/li&gt;

&lt;/ul&gt;

&lt;h2&gt;
  
  
  Result
&lt;/h2&gt;

&lt;p&gt;We have created the architectural design shown below using the steps outlined above.&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%2Fwu39d8luoj8qcbyj1b8y.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%2Fwu39d8luoj8qcbyj1b8y.png" alt="Architecture Diagram" width="800" height="580"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;While Aspire's inner workings are outside the scope of our discussion, understanding them is still essential. &lt;/p&gt;

&lt;p&gt;Aspire is a mechanism that among other capabilities allows developers to spin up OCI-compliant containers using C#. We can configure Aspire to use either Docker or Podman, the top two leading containerization applications.&lt;/p&gt;

&lt;p&gt;Think of it as the alternatives to writing &lt;code&gt;docker-compose&lt;/code&gt; files and nothing more.&lt;/p&gt;

&lt;p&gt;Furthermore, let's understand the connection between a deployed resource (such as a PostgreSQL database) and a project.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;builder.AddProject&amp;lt;Projects.ExampleApp_Web&amp;gt;("web")
    .WithReference(exampleDatabase);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Idiomatically speaking, the above line adds a connecting string configuration to the ExampleApp.Web project, which can be accessed using the project's HostApplicationBuilder.&lt;/p&gt;

&lt;p&gt;For example&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var builder = WebApplication.CreateBuilder(args);
var databaseConnectionString = builder.Configuration.GetConnectionString("ExampleDB");

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

&lt;/div&gt;



&lt;p&gt;However, these details can/may be abstracted away when we use the Aspire hosting packages.&lt;/p&gt;

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

&lt;p&gt;Aspire is an incredible framework that significantly improves developer productivity, especially for local development. It also reduces the barrier for new software engineers/programmers/developers to pick up the fundamental concepts and best practices of DevOps.&lt;/p&gt;

&lt;p&gt;Please feel free to comment your thoughts on it. I welcome all feedback and will do my best to update the content to reflect up-to-date and accurate information.&lt;/p&gt;

&lt;p&gt;Link to companion github repo: &lt;a href="https://github.com/chandanbsd/aspire-postgres-efcore-aspnet-template/tree/main" rel="noopener noreferrer"&gt;https://github.com/chandanbsd/aspire-postgres-efcore-aspnet-template/tree/main&lt;/a&gt;&lt;/p&gt;

</description>
      <category>postgres</category>
      <category>entityframeworkcore</category>
      <category>aspnet</category>
    </item>
    <item>
      <title>How to design a beautiful website? CSS Super Simplified Explanation</title>
      <dc:creator>Chandan Bangalore</dc:creator>
      <pubDate>Mon, 20 Jun 2022 00:01:18 +0000</pubDate>
      <link>https://dev.to/chandanbsd/how-to-design-a-beautiful-website-css-super-simplified-explanation-1ab5</link>
      <guid>https://dev.to/chandanbsd/how-to-design-a-beautiful-website-css-super-simplified-explanation-1ab5</guid>
      <description>&lt;h2&gt;
  
  
  What is CSS?
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;CSS stands for Cascade Styling Sheets&lt;/li&gt;
&lt;li&gt;It is a set of rules that determine the look and feel of web pages.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  How do we write CSS?
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;First we select the HTML element( or tag)&lt;/li&gt;
&lt;li&gt;Then we provide key-value pairs that depict the element’s design.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nt"&gt;selector&lt;/span&gt; 
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="py"&gt;style-name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;value&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;p&gt;&lt;iframe height="600" src="https://codepen.io/chandanbsd/embed/poaBYym?height=600&amp;amp;default-tab=result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  Where do we write CSS?
&lt;/h2&gt;

&lt;p&gt;We can write CSS in 3 possible locations:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Inline CSS&lt;/li&gt;
&lt;li&gt;Internal CSS&lt;/li&gt;
&lt;li&gt;External CSS&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Inline CSS&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;CSS rules are specified as values to the style attribute of the tags&lt;/p&gt;

&lt;p&gt;&lt;iframe height="600" src="https://codepen.io/chandanbsd/embed/XWZQGMX?height=600&amp;amp;default-tab=result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Disadvantages:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Redundant Code:&lt;/strong&gt; Say we have ten paragraphs whose text color we need to set to red, then we will have to specify the style ten times which is not a good approach&lt;/p&gt;

&lt;p&gt;&lt;iframe height="600" src="https://codepen.io/chandanbsd/embed/MWQRxjg?height=600&amp;amp;default-tab=result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Hard to maintain:&lt;/strong&gt;  Suppose we need to update the style of all paragraph tags, then we would have to search and manually change every occurrence of the p tag.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Impacts page performance:&lt;/strong&gt; Inline CSS often increases the HTML document's total size and the webpage's loading time.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Decreases Accessibility:&lt;/strong&gt; The purpose of HTML is to only provide structure to content. Mixing style rules and HTML will make it harder for screen readers to interpret the webpage.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;h3&gt;
  
  
  Internal CSS
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Here too we write the CSS within the HTML document. However, all CSS instructions are grouped together and placed under a special HTML tag i.e, &lt;code&gt;&amp;lt;style&amp;gt; &amp;lt;/style&amp;gt;&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;iframe height="600" src="https://codepen.io/chandanbsd/embed/VwQNRpM?height=600&amp;amp;default-tab=result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Advantages:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Allows CSS styles to be reused between elements&lt;/li&gt;
&lt;li&gt;Improve the readability and maintainability of code.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

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

&lt;ul&gt;
&lt;li&gt;It still increases the size of the HTML document&lt;/li&gt;
&lt;li&gt;Code may be reused within the same webpage but cannot be shared between multiple web pages under the same website.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;h3&gt;
  
  
  External CSS
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Here we write all the CSS elements in its own .css file and then we use the &lt;code&gt;&amp;lt;link&amp;gt; &amp;lt;/link&amp;gt;&lt;/code&gt;  HTML tag to connect the webpage to the CSS file, i.e. &lt;code&gt;&amp;lt;link rel = "stylesheet" href = "{ Enter location of CSS file}" /&amp;gt;&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Advantages:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Complete Code Reusability

&lt;ul&gt;
&lt;li&gt;Similar elements in the same webpage can share the styles&lt;/li&gt;
&lt;li&gt;We can have a shared CSS file between webpages (Ex: The header, navbar, and footer on any webpage under the same website may share the same styling)&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;Improves Code Readability and Maintainability&lt;/li&gt;

&lt;li&gt;Web pages load faster since HTML files are not large due to CSS stylings.
&lt;/li&gt;

&lt;/ul&gt;

&lt;/li&gt;

&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;
&lt;span class="nt"&gt;&amp;lt;html&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;head&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;link&lt;/span&gt; &lt;span class="na"&gt;rel = &lt;/span&gt;&lt;span class="s"&gt;"stylesheet"&lt;/span&gt; &lt;span class="na"&gt;href = &lt;/span&gt;&lt;span class="s"&gt;"index.css"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/head&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;body&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;p&amp;gt;&lt;/span&gt;This line is white but its background is black&lt;span class="nt"&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;p&amp;gt;&lt;/span&gt;This line is also another white line but its background is black&lt;span class="nt"&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/body&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;html&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nt"&gt;body&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;background-color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="no"&gt;black&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nt"&gt;p&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="no"&gt;white&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;   
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;iframe height="600" src="https://codepen.io/chandanbsd/embed/VwQNRbM?height=600&amp;amp;default-tab=result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  CSS Selectors
&lt;/h2&gt;

&lt;p&gt;If we write internal or external CSS instead of inline CSS, we need to understand a CSS concept called selectors. There are three main types of selectors&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Element Selectors&lt;/li&gt;
&lt;li&gt;Class Selectors&lt;/li&gt;
&lt;li&gt;Id selectors&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Element Selectors
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Here we use the name of the tag to define the styles.&lt;/li&gt;
&lt;li&gt;The styling will be applied to all occurrences of that tag on the webpage&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;iframe height="600" src="https://codepen.io/chandanbsd/embed/wvyZOvX?height=600&amp;amp;default-tab=result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  Class Selectors
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Class selectors allow us to identify one or more elements and style them the same.&lt;/li&gt;
&lt;li&gt;We do this by giving the selected tags a &lt;code&gt;class&lt;/code&gt; attribute and a common value.&lt;/li&gt;
&lt;li&gt;We then write the value prefixed with the&lt;code&gt;.&lt;/code&gt; while specifying the CSS rule&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;iframe height="600" src="https://codepen.io/chandanbsd/embed/wvyZOvX?height=600&amp;amp;default-tab=result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  ID selectors
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;ID selectors allow us to identify a single element uniquely&lt;/li&gt;
&lt;li&gt;We can do this by using the &lt;code&gt;id&lt;/code&gt; attribute&lt;/li&gt;
&lt;li&gt;We then write the value prefixed with the &lt;code&gt;#&lt;/code&gt; while specifying the CSS rule&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;iframe height="600" src="https://codepen.io/chandanbsd/embed/QWQPobz?height=600&amp;amp;default-tab=result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  How does CSS handle conflicts?
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;We saw multiple ways (element, class, and id) to select elements and give them style. We also visited the locations (inline, internal, and external) where the CSS rules may be specified.&lt;/li&gt;
&lt;li&gt;If we use some or a combination of these, then there is a possibility that different styles are specified for the same element.&lt;/li&gt;
&lt;li&gt;To handle such ambiguity, the browser uses a concept known as CSS Specificity. In the simplest terms, the style with the higher specificity takes precedence (or wins).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Precedence based on Location of CSS Rule:&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;Inline CSS has the highest precedence&lt;/li&gt;
&lt;li&gt;Internal CSS comes next&lt;/li&gt;
&lt;li&gt;External CSS is the least dominant.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;strong&gt;Precedence based on Type of CSS Selector:&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;ID selector has the highest precedence&lt;/li&gt;
&lt;li&gt;Class selector comes next&lt;/li&gt;
&lt;li&gt;Element selector is the most minor&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;strong&gt;What if the same selector is used at the same level? What happens then?&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;In this case, the last rule takes precedence over the earlier rule.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

</description>
    </item>
    <item>
      <title>How to create a webpage? Super Simplified Explanation of HTML</title>
      <dc:creator>Chandan Bangalore</dc:creator>
      <pubDate>Sun, 29 May 2022 00:29:44 +0000</pubDate>
      <link>https://dev.to/chandanbsd/how-to-create-a-webpage-super-simplified-explanation-of-html-2pma</link>
      <guid>https://dev.to/chandanbsd/how-to-create-a-webpage-super-simplified-explanation-of-html-2pma</guid>
      <description>&lt;p&gt;&lt;strong&gt;HTML&lt;/strong&gt; stands for HyperText Markup Language. In simple terms, HTML is the language that gives structure to content on a webpage. That’s it! &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Where to write HTML?&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;HTML instructions need to be saved in a file with the extension .html or .htm. This is similar to how we save text files as .txt and Microsoft office documents as .docx&lt;/li&gt;
&lt;li&gt;The file extensions directly indicate to the web browser that it is an HTML file and needs to be processed, and its output is displayed to the user at the web address URL.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That’s it! &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Structure of an HTML document?&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Any HTML document will have the following basic structure&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;html&amp;gt;&lt;/span&gt;

    &lt;span class="nt"&gt;&amp;lt;head&amp;gt;&lt;/span&gt; 
                {Special Section that describes the webpage} 
    &lt;span class="nt"&gt;&amp;lt;/head&amp;gt;&lt;/span&gt;

    &lt;span class="nt"&gt;&amp;lt;body&amp;gt;&lt;/span&gt; 
                {Put Content to be displayed on webpage here} 
    &lt;span class="nt"&gt;&amp;lt;body&amp;gt;&lt;/span&gt;

&lt;span class="nt"&gt;&amp;lt;/html&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;HTML instructions are called “tags.” At a fundamental level, there are two types of tags:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Tags that require explicit opening and closing (ex: &lt;code&gt;&amp;lt;html&amp;gt;&lt;/code&gt; and &lt;code&gt;&amp;lt;/html&amp;gt;&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;Self-closing tags, i.e., they need to be written only once (ex: &lt;code&gt;&amp;lt;hr/&amp;gt;&lt;/code&gt;)&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Furthermore, a special property of HTML is that it is &lt;em&gt;case insensitive&lt;/em&gt; i.e. tags can be written in uppercase, lowercase or a mix of both,  &lt;code&gt;&amp;lt;HTML&amp;gt;&lt;/code&gt;, &lt;code&gt;&amp;lt;html&amp;gt;&lt;/code&gt; , &lt;code&gt;&amp;lt;hTmL&amp;gt;&lt;/code&gt; all have the same meaning. However, the convention is to write all HTML tags in lowercase.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Let’s look at an example webpage:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;html&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;head&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;title&amp;gt;&lt;/span&gt;Beautiful Website&lt;span class="nt"&gt;&amp;lt;/title&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;/head&amp;gt;&lt;/span&gt;

    &lt;span class="nt"&gt;&amp;lt;body&amp;gt;&lt;/span&gt;

        &lt;span class="nt"&gt;&amp;lt;h1&amp;gt;&lt;/span&gt;Heading Line&lt;span class="nt"&gt;&amp;lt;/h1&amp;gt;&lt;/span&gt;

    &lt;span class="nt"&gt;&amp;lt;hr/&amp;gt;&lt;/span&gt;

        &lt;span class="nt"&gt;&amp;lt;p&amp;gt;&lt;/span&gt;This is a line in the paragraph.
      This is another line in our paragraph.
      This is also a line in our paragraph
        &lt;span class="nt"&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;

    &lt;span class="nt"&gt;&amp;lt;/body&amp;gt;&lt;/span&gt;

&lt;span class="nt"&gt;&amp;lt;/html&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Result:&lt;/strong&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%2Fyzlohtpj20ezlx5v2wb5.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%2Fyzlohtpj20ezlx5v2wb5.png" alt="Result Sceenshot" width="800" height="438"&gt;&lt;/a&gt;&lt;/p&gt;

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

&lt;p&gt;Let’s look at each of these instructions and what they mean.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;As always the entire document is enclosed between the &lt;code&gt;&amp;lt;html&amp;gt;&lt;/code&gt; and &lt;code&gt;&amp;lt;/html&amp;gt;&lt;/code&gt; tags.&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Next is the “head” section enclosed between the &lt;code&gt;&amp;lt;head&amp;gt;&lt;/code&gt; and &lt;code&gt;&amp;lt;/html&amp;gt;&lt;/code&gt; is special information that describes our webpage. There are a lot of tags that can be enclosed within the head section. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Here I have used the &lt;code&gt;&amp;lt;title&amp;gt;&lt;/code&gt; &lt;code&gt;&amp;lt;/title&amp;gt;&lt;/code&gt; tags. The content enclosed within these tags is displayed in the web browser's title bar below.
&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%2Fh31frnkp6x7xg50qttzm.png" alt="Browser Header" width="800" height="101"&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Next is the “body” section enclosed with &lt;code&gt;&amp;lt;body&amp;gt;&lt;/code&gt; &lt;code&gt;&amp;lt;/body&amp;gt;&lt;/code&gt;.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;&amp;lt;h1&amp;gt;&lt;/code&gt; &lt;code&gt;&amp;lt;/h1&amp;gt;&lt;/code&gt; tags are called Heading Level 1, and these ensure that the content is displayed prominently on the webpage.&lt;/li&gt;
&lt;li&gt; &lt;code&gt;&amp;lt;hr/&amp;gt;&lt;/code&gt; is a self-closing tag called the “horizontal rule,” which displays a horizontal line in HTML.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;&amp;lt;p&amp;gt;&lt;/code&gt; and &lt;code&gt;&amp;lt;/p&amp;gt;&lt;/code&gt; tags are called Paragraph tags which are used to structure paragraphs of content in the webpage &lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;So, All it takes to make a website is HTML?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Technically yes. HTML is sufficient to create a skeletal website. But to make a beautiful webpage, we need CSS. Likewise, we also need JavaScript to create a web application (a fancy name for a dynamic website and supports user interaction).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What are all the HTML tags?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;HTML has evolved over the years to include a massive list of tags. The best way to find and understand the different HTML tags is using Mozilla’s MDN documentation &lt;a href="https://developer.mozilla.org/en-US/docs/Web/HTML" rel="noopener noreferrer"&gt;https://developer.mozilla.org/en-US/docs/Web/HTML&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Further Reading:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This article is only meant to be the most basic guide to HTML. There is a lot more to HTML than what is described above. In fact the latest iteration of HTML i.e., HTML5 has the following skeletal structure.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="cp"&gt;&amp;lt;!DOCTYPE html&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;html&lt;/span&gt; &lt;span class="na"&gt;lang=&lt;/span&gt;&lt;span class="s"&gt;"en"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;head&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;meta&lt;/span&gt; &lt;span class="na"&gt;charset=&lt;/span&gt;&lt;span class="s"&gt;"UTF-8"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;meta&lt;/span&gt; &lt;span class="na"&gt;http-equiv=&lt;/span&gt;&lt;span class="s"&gt;"X-UA-Compatible"&lt;/span&gt; &lt;span class="na"&gt;content=&lt;/span&gt;&lt;span class="s"&gt;"IE=edge"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;meta&lt;/span&gt; &lt;span class="na"&gt;name=&lt;/span&gt;&lt;span class="s"&gt;"viewport"&lt;/span&gt; &lt;span class="na"&gt;content=&lt;/span&gt;&lt;span class="s"&gt;"width=device-width, initial-scale=1.0"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;title&amp;gt;&lt;/span&gt;{Name of Webpage}&lt;span class="nt"&gt;&amp;lt;/title&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/head&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;body&amp;gt;&lt;/span&gt;
    {Content of HTML document}
&lt;span class="nt"&gt;&amp;lt;/body&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/html&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Such additions to HTML are due to the fact that the web itself is evolving over time and modern requirements necessitate such changes. However, each of these is very well documented in &lt;a href="https://developer.mozilla.org/en-US/docs/Web/HTML" rel="noopener noreferrer"&gt;MDN&lt;/a&gt; and easy to understand.&lt;/p&gt;

&lt;p&gt;Try it on your own: &lt;a href="https://codepen.io/chandanbsd/pen/NWyypjv" rel="noopener noreferrer"&gt;https://codepen.io/chandanbsd/pen/NWyypjv&lt;/a&gt;&lt;/p&gt;

</description>
      <category>tutorial</category>
      <category>html</category>
      <category>webdev</category>
    </item>
    <item>
      <title>How do websites work? Super Simplified Explanation</title>
      <dc:creator>Chandan Bangalore</dc:creator>
      <pubDate>Fri, 27 May 2022 23:25:48 +0000</pubDate>
      <link>https://dev.to/chandanbsd/how-do-websites-work-super-simplified-explanation-2eha</link>
      <guid>https://dev.to/chandanbsd/how-do-websites-work-super-simplified-explanation-2eha</guid>
      <description>&lt;p&gt;&lt;strong&gt;Internet and Web Addresses:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;To access a website on the world wide web, we use IP addresses&lt;/li&gt;
&lt;li&gt;Each Website has an associated IP address (This is similar to our home address)&lt;/li&gt;
&lt;li&gt;When we enter the IP addresses (we actually enter web address like &lt;a href="http://www.google.com" rel="noopener noreferrer"&gt;www.google.com&lt;/a&gt; which the browser converts into IP address) on a web browser, the web browser makes a query to the webserver (A computer that handles user requests and provides responses) and then downloads three files: an HTML file, a CSS file, and a javascript file.&lt;/li&gt;
&lt;li&gt;The web browser then takes these three files to show us the webpage&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;What is the HTML file?&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The HTML file is similar to the “stone bricks.” we use to build our house.&lt;/li&gt;
&lt;li&gt;i.e., Its only purpose is to define the structure of the webpage&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;For Example:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;HTML&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;HEAD&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;TITLE&amp;gt;&lt;/span&gt; My Personal Website &lt;span class="nt"&gt;&amp;lt;/TITLE&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;HEAD&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;BODY&amp;gt;&lt;/span&gt;
            Hello World, My name is Chandan.
    &lt;span class="nt"&gt;&amp;lt;BODY&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/HTML&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Output:&lt;br&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%2Fdsl0wjnrknij8ap3c6r1.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%2Fdsl0wjnrknij8ap3c6r1.png" alt="HTML Output" width="748" height="170"&gt;&lt;/a&gt;&lt;/p&gt;

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

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;In the above HTML snippet, we can see that the HTML tags provide a structure that identifies the webpage. In this case, &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;&amp;lt;TITLE&amp;gt; My Personal Website &amp;lt;/TITLE&amp;gt;&lt;/code&gt; &lt;br&gt;
This line ensures that the title of our website is called “My Personal Website"&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;&amp;lt;BODY&amp;gt; Hello World, My name is Chandan &amp;lt;/BODY&amp;gt;&lt;/code&gt;&lt;br&gt;
This line ensures that the content or body of our website displays the line “Hello World, My name is Chandan”&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;What is the CSS file?&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The CSS tells the web browser how to present our HTML elements.&lt;/li&gt;
&lt;li&gt;i.e., it is similar to a hairstylist who gives shape, length, and color to our hair&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;For Example:&lt;br&gt;
&lt;/p&gt;

&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nt"&gt;body&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="no"&gt;lightgreen&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;background-color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;grey&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;text-align&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;center&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;



&lt;p&gt;OUTPUT:&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%2Fab5nnkyowmv5keiap0xs.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%2Fab5nnkyowmv5keiap0xs.png" alt="CSS Output" width="588" height="115"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The above example shows that HTML tells the web browser “WHAT” to display, and CSS tells the web browser “HOW” to show.&lt;/p&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;What is a JavaScript file?&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;JS files provide the functionality or “actions” of a webpage.&lt;/li&gt;
&lt;li&gt;Without JavaScript, we can only display some content beautifully using HTML and CSS.&lt;/li&gt;
&lt;li&gt;But to provide some functionality, we need to use JavaScript.&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;For Example:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;entireDocumentVariable&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;querySelector&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;html&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="nx"&gt;entireDocumentVariable&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;addEventListener&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;click&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;alert&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Hello, Welcome to my website&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;


&lt;p&gt;Result:&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&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%2Fa9e5jlttbiuq981q7nwf.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%2Fa9e5jlttbiuq981q7nwf.png" alt="JavaScript Output" width="441" height="93"&gt;&lt;/a&gt;&lt;/p&gt;

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

&lt;ul&gt;
&lt;li&gt;Using javascript, we have written a functionality where a user clicks on any area inside the web page, and he is greeted with an alert saying, "Hello, Welcome to my website."&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Source Code: &lt;a href="https://codepen.io/chandanbsd/pen/WNMdBZm" rel="noopener noreferrer"&gt;https://codepen.io/chandanbsd/pen/WNMdBZm&lt;/a&gt;&lt;/p&gt;

</description>
      <category>tutorial</category>
      <category>css</category>
      <category>html</category>
      <category>javascript</category>
    </item>
  </channel>
</rss>
