<?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: Elijah Gathanga</title>
    <description>The latest articles on DEV Community by Elijah Gathanga (@gathangaelijah).</description>
    <link>https://dev.to/gathangaelijah</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%2F2985280%2F06f146ce-aad6-4fed-a23d-d3325b560512.jpeg</url>
      <title>DEV Community: Elijah Gathanga</title>
      <link>https://dev.to/gathangaelijah</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/gathangaelijah"/>
    <language>en</language>
    <item>
      <title>Is Blockchain Really Secure?</title>
      <dc:creator>Elijah Gathanga</dc:creator>
      <pubDate>Sun, 29 Jun 2025 08:10:22 +0000</pubDate>
      <link>https://dev.to/gathangaelijah/is-blockchain-really-secure-f4e</link>
      <guid>https://dev.to/gathangaelijah/is-blockchain-really-secure-f4e</guid>
      <description>&lt;h1&gt;
  
  
  Would you trust a system where no one is IN CHARGE?
&lt;/h1&gt;

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

&lt;p&gt;If you have heard of blockchain, you must know that one of the selling point is &lt;strong&gt;decentralization&lt;/strong&gt;. This would mean that, if no one is in charge for things to run smoothly, the system must be very &lt;strong&gt;perfect&lt;/strong&gt;. You might have heard terms like consensus, cryptographic hashing, private key and public key and so many other terms in relation to this technology. Well, in this article I will explore what makes blockchain technology secure and establish  if there is a chance of &lt;strong&gt;breaking&lt;/strong&gt; it. &lt;/p&gt;

&lt;h2&gt;
  
  
  Learning outcomes
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Understand how information in blockchain is stored securely.&lt;/li&gt;
&lt;li&gt;Know the factors that might compromise blockchain security.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Old storage of information
&lt;/h2&gt;

&lt;p&gt;If you have a very important information like record of payments, certificates, contracts etc. you might want to store them securely. If you are rich, you can buy a safe and store it there. That way you are sure that its only you who can access the information. If you continue adding more information, eventually the safe will be full and you will need to either discard the old information to make space for the new information or buy another safe to store the new information. Think of a place like a land registry, where we need to have the records of all the lands and we need to keep updating who owns the land during a particular period. That is how information is stored traditionally. There are risks of information being altered or even getting lost hence credibility is lost.&lt;/p&gt;

&lt;h2&gt;
  
  
  New safe
&lt;/h2&gt;

&lt;p&gt;In this digital era, blockchain technology has come to rescue us from this. Just like information is stored in a safe, in blockchain information is stored in a block. Once the block is full, another block is created and its linked to the previous block. Well, that's just part if it. &lt;/p&gt;

&lt;h3&gt;
  
  
  How does the linking of blocks happen?
&lt;/h3&gt;

&lt;p&gt;When this data is full in one block, it is bundled together and its given a unique serial number. In blockchain we call this a &lt;strong&gt;hash&lt;/strong&gt;. This has been obtained through computation of mathematical algorithms through a process called &lt;strong&gt;Cryptographic hashing&lt;/strong&gt;. Any new block added must be linked to the previous block. This makes the information &lt;strong&gt;Chronological&lt;/strong&gt;.&lt;/p&gt;

&lt;h4&gt;
  
  
  Why is the hash important?
&lt;/h4&gt;

&lt;p&gt;This has is the one that is stored in the next block so that a link between the two blocks is established(&lt;em&gt;the chain&lt;/em&gt;). Any time you change the information in a particular block, this hash changes. If there is a difference between the hashes, that means that information was tampered with. This guarantees &lt;strong&gt;Immutability&lt;/strong&gt;, meaning once information is stored in a block it cannot be changed. You will be able to know if the information is credible or not. This is useful in verification systems like in payments, voting and other applications.&lt;/p&gt;

&lt;h4&gt;
  
  
  How does hashing guarantee security?
&lt;/h4&gt;

&lt;p&gt;For a block to be linked to the next block, a lot of work has been done by special people called the &lt;strong&gt;Miners who are also validators&lt;/strong&gt;. These are the people who are responsible for adding the information to the blocks and adding valid blocks to the chain. They do some mathematical computations to verify information and create a new block to be added to the chain. They have invested heavily on hardware infrastructure to make sure the mathematical calculations are done faster. The process of computing mathematical computations to show some work done is called &lt;strong&gt;proof-of-work&lt;/strong&gt;. Only valid blocks are added. &lt;br&gt;
The longer the chain, the harder the process and more power to compute is need. That makes it hard for someone to do computations for all the blocks available  to change or access the information. That is security.&lt;/p&gt;

&lt;h2&gt;
  
  
  What if I want to change the information?
&lt;/h2&gt;

&lt;p&gt;Since blockchain is decentralized, you might want to cheat and change the information in a particular block. However, this can be difficult because every participant in the blockchain have the same record of all the blocks present in the chain. If one of the participants has a different record, it can be compared to the other participants its rejected. This is possible through &lt;strong&gt;Consensus Mechanism&lt;/strong&gt;. &lt;/p&gt;

&lt;p&gt;However, if there are &lt;strong&gt;50 + 1&lt;/strong&gt; participants with same record the information is changed. This is &lt;strong&gt;Feasibly Impossible&lt;/strong&gt;. You would need a lot of computational power to be able to change all the records of all the participants in the network and this is very expensive. That is why governments fear it  so much.&lt;/p&gt;

&lt;h3&gt;
  
  
  What if the validators(miners) are compromised?
&lt;/h3&gt;

&lt;p&gt;Every human has a greedy part and might want the power to control the chain for their own benefits. In blockchain the honest validators are rewarded. This is how they make their money. No one wants to break a hand that feeds them. &lt;br&gt;
They also spend so much resources to validate the blocks and its their investment. Being compromised would only mean losses for them. This &lt;strong&gt;Incentives&lt;/strong&gt; is a reward mechanism for honest validators. &lt;/p&gt;

&lt;h2&gt;
  
  
  How do I interact with information in a blockchain?
&lt;/h2&gt;

&lt;p&gt;Unlike information stored in the safe where you are the only one who can guarantee that whatever I claim is true, in blockchain there is &lt;strong&gt;Private and Public keys&lt;/strong&gt;.&lt;br&gt;
&lt;strong&gt;Private key&lt;/strong&gt; is used to sign the information. Just like a message is sign by the sender.&lt;br&gt;
This should be private as the word suggests. This is like a key to access the safe and access your information that was stored.&lt;br&gt;
&lt;strong&gt;Public key&lt;/strong&gt; This is visible to the public. Think of it like an address of safe that is made public.&lt;br&gt;
Anyone with your public key can write to you some information.&lt;br&gt;
To be able to read the information written to you, you use your private key to access it.&lt;br&gt;
The combination of this make sharing information in a blockchain secure. Once you lose your private key, you lose your information because there is no way to claim you are the owner.&lt;/p&gt;

&lt;h1&gt;
  
  
  Conclusion
&lt;/h1&gt;

&lt;p&gt;While blockchain technology is here with us, its good to know where issues may arise and compromise the security of your data.I remember the way I was scammed 98$ was through me sharing my private key in the name of bitcoin mining.I was naive and I didn't know. I was just a freshman in campus. This information helps you understand that blockchain systems have security mechanisms but might be compromised in one way or another. You need to be very careful how you interact with this systems.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;There are a lot scams related to mining. Now you know that you need a lot of resources to become a miner. If someone is telling you he will do it for you for 100$, think twice!&lt;/li&gt;
&lt;li&gt;There are still risks of attacks. Phishing and social engineering becoming more prevalent as the blockchain is difficult to hack.&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.techopedia.com/crypto-hacks-low-tech-exploits-rise" rel="noopener noreferrer"&gt;Nobitex Attack 2025&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;-&lt;a href="https://en.wikipedia.org/wiki/Bybit" rel="noopener noreferrer"&gt;The Bybit- The Billion Dollar attack&lt;/a&gt;. On February 21, 2025, Bybit announced on X that it had been hacked.[4] According to Bybit, about 400,000 Ethereum was stolen,[11][12] which had an approximate notional value of $1.4 billion, making it the largest cryptocurrency exchange hack to date. &lt;/p&gt;

&lt;p&gt;Blockchain has so much hope, I still believe we should be on-chain. As a secure way to store information, provide governance and as a solution to social problems like corruption. &lt;br&gt;
&lt;strong&gt;Yes, Trust the protocol(the system)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Engage with me on my socials &lt;a href="//www.linkedin.com/in/elijah-gathanga-88b601262"&gt;LinkedIn&lt;/a&gt; &lt;a href="https://x.com/charagu_elijah" rel="noopener noreferrer"&gt;on X&lt;/a&gt;&lt;br&gt;
Have a look at my &lt;a href="https://github.com/GathangaElijah" rel="noopener noreferrer"&gt;Github&lt;/a&gt;&lt;/p&gt;

</description>
      <category>blockchain</category>
      <category>web3</category>
      <category>security</category>
    </item>
    <item>
      <title>Dive In Web Development in Go</title>
      <dc:creator>Elijah Gathanga</dc:creator>
      <pubDate>Fri, 28 Mar 2025 11:33:12 +0000</pubDate>
      <link>https://dev.to/gathangaelijah/dive-in-web-development-in-go-nc1</link>
      <guid>https://dev.to/gathangaelijah/dive-in-web-development-in-go-nc1</guid>
      <description>&lt;h1&gt;
  
  
  &lt;strong&gt;Introduction to Web Development in Go&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;Web development allows us to create powerful digital solutions across various industries, from e-commerce to social media. While many programming languages can be used for web development, Go offers unique advantages that make it particularly compelling for building robust and high-performance web applications. In this article, we’ll explore why Go is an excellent choice for web development and guide you through setting up a simple web server using Go.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Why choose go for web development&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Go offers ideal features which makes it ideal for web development. &lt;/p&gt;

&lt;p&gt;1. &lt;strong&gt;Performance&lt;/strong&gt; - Go is a statically typed language and compiled. This means that it is directly converted to machine code thus faster execution time. &lt;/p&gt;

&lt;p&gt;2. &lt;strong&gt;Concurrency&lt;/strong&gt; - Go was built with concurrency in mind. With go-routines and channels, you can easily build highly scalable and high performing web applications which can handle many tasks at the same time.&lt;/p&gt;

&lt;p&gt;3. &lt;strong&gt;Simplicity&lt;/strong&gt; - It has a clean syntax which is easy to learn and understand. &lt;/p&gt;

&lt;p&gt;4. &lt;strong&gt;Reduced learning curve&lt;/strong&gt; - Due to a small set of keywords and concepts in go, the learning curve is significantly reduced. &lt;/p&gt;

&lt;p&gt;5. &lt;strong&gt;Standard library&lt;/strong&gt; - Go library has extensive support for building web servers and http requests, thus there is no need for third party libraries. &lt;/p&gt;

&lt;p&gt;6. &lt;strong&gt;Cross-Platform&lt;/strong&gt; - Go code once compiled, it can run on other operating systems without being modified.&lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;strong&gt;What you will learn in this article&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;This guide is perfect for beginners who have just learned Go and want to start building web applications. By the end of this article, you’ll be able to set up a basic web server in Go, handle HTTP requests, and serve HTML templates. &lt;em&gt;note&lt;/em&gt; This article assumes you are familiar with go syntax or at least you understand go.  If you would like to have a look at go &lt;a href="https://gobyexample.com/" rel="noopener noreferrer"&gt;&lt;strong&gt;visit&lt;/strong&gt;&lt;/a&gt; to learn more about go syntax.  Feel free to check other sites of your choice.&lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;strong&gt;Setting up Go Development Environment&lt;/strong&gt;
&lt;/h1&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Installing go in your computer&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;If you have not installed go in your computer, follow the instructions from &lt;a href="https://go.dev/doc/install" rel="noopener noreferrer"&gt;&lt;strong&gt;this&lt;/strong&gt;&lt;/a&gt; and only proceed if Go has successfully been installed.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Choosing an IDE&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;In this case I will be using a visual studio code editor. In case you want to install it &lt;a href="https://code.visualstudio.com/docs/setup/setup-overview" rel="noopener noreferrer"&gt;&lt;strong&gt;Follow this link&lt;/strong&gt;&lt;/a&gt; and follow instructions. &lt;em&gt;note:&lt;/em&gt; &lt;strong&gt;Before proceeding to the next ensure you have a text editor and go installed in your machine. It's very important for the next section.&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Setting up the workspace&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;For Simplicity, we have a relatively straight forward folder structure.&lt;/p&gt;

&lt;p&gt;This is the folder structure&lt;/p&gt;

&lt;p&gt;There are two main folders: static &lt;strong&gt;templates&lt;/strong&gt; &lt;strong&gt;static&lt;/strong&gt; - will house all our static files like css files, javascript files etc. &lt;strong&gt;templates&lt;/strong&gt; - will house all our html templates. There is also a very important file called &lt;strong&gt;main.go&lt;/strong&gt;. This is the entry point of our program.&lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;strong&gt;Writing your first Go web Server&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;Now let's dive into more interesting stuff. The real programming. Before we create our first server, it is important for you to understand how web applications are built. understand concepts like &lt;strong&gt;HTTP&lt;/strong&gt; and how it works. The explanation of how it works is out of scope of this article. If you want to read more about &lt;strong&gt;HTTP&lt;/strong&gt; and its inner workings &lt;a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Overview" rel="noopener noreferrer"&gt;&lt;em&gt;follow this link&lt;/em&gt;&lt;/a&gt;.  What you should know about &lt;strong&gt;HTTP&lt;/strong&gt; in a nutshell is that it's a &lt;em&gt;stateless protocol, text-based, request-response protocol that uses the client-server computing model&lt;/em&gt; This diagram shows the basic way a web application works.&lt;/p&gt;

&lt;p&gt;How Web Application Works&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%2F1jaicc06w7530zke7a1f.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%2F1jaicc06w7530zke7a1f.png" alt="Image description" width="481" height="211"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Creating a simple HTTP server&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Let’s set up a basic HTTP server in Go. The following code snippet demonstrates how to create a server that listens on port 8080: &lt;/p&gt;

&lt;p&gt;Creating a simple server&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%2Fsb8lgk0rbfvn4rtpu9ui.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%2Fsb8lgk0rbfvn4rtpu9ui.png" alt="Image description" width="525" height="257"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;http.ListenAndServe(":8080", nil)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This code snippet creates a server and listens on &lt;strong&gt;port 8080&lt;/strong&gt;.  The method &lt;strong&gt;ListenAndServe&lt;/strong&gt; from the &lt;strong&gt;http&lt;/strong&gt; interface receives a port number to listen to and a handler function. &lt;strong&gt;nil&lt;/strong&gt; - the nil parameter indicates that we are using a default multiplexer.&lt;/p&gt;

&lt;p&gt;We have successfully created a server that listens on &lt;strong&gt;port 8080&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;There are two main parts of a web application;&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;1. Handler&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;A &lt;em&gt;handler&lt;/em&gt; receives and processes the HTTP request sent from the client. It also calls the template engine to generate the HTML and finally bundles data into the HTTP response to be sent back to the client.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;2. Template Engine&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;A &lt;em&gt;template&lt;/em&gt; is code that can be converted into HTML that’s sent back to the client in an HTTP response message. A template can be partly in HTML or not.  A &lt;em&gt;template engine&lt;/em&gt; generates the final HTML using templates and data. &lt;a href="https://blog.gopheracademy.com/advent-2017/using-go-templates/" rel="noopener noreferrer"&gt;&lt;strong&gt;Learn more about Templates&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Handling http requests and Routing&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Routing is a critical component of any web application, as it determines how requests to various endpoints are handled. In Go, we use the http.HandleFunc function to define these routes.&lt;/p&gt;

&lt;p&gt;http.HandleFunc("/", Index)&lt;/p&gt;

&lt;p&gt;This line of code says that when we request a &lt;strong&gt;“/”&lt;/strong&gt; (&lt;em&gt;this is the root url&lt;/em&gt;),handle the path with the function &lt;strong&gt;Index&lt;/strong&gt;.  &lt;strong&gt;Routing&lt;/strong&gt; - The net/http package allows you to define routes using &lt;strong&gt;http.HandleFunc&lt;/strong&gt; or &lt;strong&gt;http.Handle&lt;/strong&gt;. The above code snippet creates a &lt;strong&gt;route&lt;/strong&gt; to the home page.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;http.HandleFunc&lt;/strong&gt; creates a rule that invokes the specified function (&lt;em&gt;Index&lt;/em&gt;) for requests that match the pattern. This creates the &lt;strong&gt;handler&lt;/strong&gt; We will talk about the &lt;strong&gt;Index&lt;/strong&gt; function later. For now just know that to handle a request, use the above method.  &lt;em&gt;Note:&lt;/em&gt; &lt;strong&gt;This method of handling the requests is if you are using a function to handle a particular pattern&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Serving Static files&lt;/strong&gt;
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;fsHandler := http.FileServer(http.Dir("./static"))  
http.Handle("/static/", http.StripPrefix("/static", fsHandler))
``

We create a handler (**fsHandler**)using the **FileServer** function that serves files from the **static** directory using the **Dir** function.  We are going to serve the content from the *static* folder with the URL paths that start with static so that a request for */static/webdev.css*, will be handled as *static/webdev.css*.

At this point we have already set up our **server**, and a **router** which sends requests to their handler functions.

# **HTML templating with Go**

Lets create a simple HTML template to test if our server is working, and execute our template and see if the css is working too.

1. Create a file in *templates* folder and name it **index.html** The content of the file should be as in the figure below. Content of the index.html


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/04qfoqemi4o1o3moklfx.png)

2. Create a function **Index** in the *main.go* file and copy the following contents. 

    Content of the Index function


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/goxs6ini17tkptuhiuci.png)

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

&lt;/div&gt;



&lt;p&gt;func Index(writer http.ResponseWriter, request *http.Request)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
The Index function receives two parameters which are a must.  \- **writer** which is of type *response writer*, which writes the response to the client. \- **request** which is a pointer to *http.request* receives a request.

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

&lt;/div&gt;



&lt;p&gt;t, err := template.ParseFiles("./templates/index.html")&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
For you to be able to execute a template, you must first load it. You can achieve this using the **ParseFiles** function.

After loading the template file you can now execute it.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;t.ExecuteTemplate(writer, "index.html", nil)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
At this point we are ready to have some content in the browser.  Now type **localhost:8080** on your favorite browser and you will see something like this. 

*Welcome Screen.*

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8ksx3cq8uif53cyzb9ht.png)

## **More detailed implementation of templating in Go**

Lets create a struct which defines our products and create a slice of product struct. Update your main.go file as follows. 

 *Updated main.go file*


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3les6rtdkgj3o46f389a.png)

Execute the template now with the products data.

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

&lt;/div&gt;



&lt;p&gt;err = indexTemplate.Execute(writer, Products)&lt;br&gt;&lt;br&gt;
    if err != nil{&lt;br&gt;&lt;br&gt;
        http.Error(writer, "Internal Server Error", http.StatusInternalServerError)&lt;br&gt;&lt;br&gt;
        fmt.Println("Error Executing Index template")&lt;br&gt;&lt;br&gt;
        return&lt;br&gt;&lt;br&gt;
    }&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;


Let’s update the index.html to create a table which will hold the products.  

*Updated index.html*


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ym3t1j9tkvvkq133s1zg.png)

Template Actions are used to generate content from the data that is passed to the **Execute** or **ExecuteTemplate** method. In this case, let’s briefly discuss the template actions used.  Template actions are enclosed in double curly braces **{{}}**.

1. {{range .}} \- It iterates through the products slice and adds the content between range and end keywords

2. {{.Name}} \- Inserts the product name in the name column in the table.

3. {{.Category}} \- Inserts the product category in the category column in the table.

4. {{.Price}} \- Inserts the product price in the name price in the table.

5. {{end}} \- marks the end of a block. In this context, templating has helped in **Dynamic Content generation**. We have been able to create a single template for our products slice.

This should be what you see in the browser after the updates. 

 *Browser with the table*


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/i2xwftswvs05hfbcp8xl.png)

If you don’t have such a screen, ensure you have a similar code as i have provided.  If we are on the same page, You can proceed to the next section.

# **Conclusion**

You now know why go will be the next king in web development. Having this brief introduction lets you familiarize with the basic structure you will be using. From this article you have learnt the following; 

1\. Creating the go server using **http.ListenAndServe** function. That's how easy it is to create a go server. 

2\. Creating routers and handler functions using **http.HandleFunc()**. 

3\. Serving the static files using **http.ServeFile()** function.

 4\. Parsing and executing template files using **template.Parsefiles()** and **Execute** functions.

This is just getting you started to develop web applications in Golang. ***Coming up…*** \- Creating a Restful API And Database Integration.

***Stay Tuned***  **It's time to get started on the Big idea**
















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

&lt;/div&gt;

</description>
      <category>webdev</category>
      <category>beginners</category>
      <category>go</category>
      <category>learning</category>
    </item>
  </channel>
</rss>
