<?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: Margaret Apiyo</title>
    <description>The latest articles on DEV Community by Margaret Apiyo (@apiyomargaret).</description>
    <link>https://dev.to/apiyomargaret</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%2F3893734%2Faecf1ff9-5322-4304-9a1e-31af603738dc.png</url>
      <title>DEV Community: Margaret Apiyo</title>
      <link>https://dev.to/apiyomargaret</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/apiyomargaret"/>
    <language>en</language>
    <item>
      <title>Why Port 8080 and Not 80? A Beginner’s Tale in Go</title>
      <dc:creator>Margaret Apiyo</dc:creator>
      <pubDate>Fri, 15 May 2026 07:40:58 +0000</pubDate>
      <link>https://dev.to/apiyomargaret/why-port-8080-and-not-80-a-beginners-tale-in-go-dle</link>
      <guid>https://dev.to/apiyomargaret/why-port-8080-and-not-80-a-beginners-tale-in-go-dle</guid>
      <description>&lt;p&gt;****I&lt;/p&gt;

&lt;p&gt;recently started my coding journey with Go. If you’re a beginner looking for a language that is simple yet incredibly powerful, I can’t recommend Go enough.&lt;/p&gt;

&lt;p&gt;While building my first Go HTTP web server, I hit a point of curiosity. I learned that a server must "listen" on a specific port number, but I kept seeing 8080 in every tutorial instead of the standard 80.&lt;/p&gt;

&lt;p&gt;I did some digging, and here is what I found.&lt;/p&gt;

&lt;h2&gt;
  
  
  What exactly is a Port?
&lt;/h2&gt;

&lt;p&gt;Think of an IP address as the building address and a Port as the specific door (entry point). The port number decides which software gets the request. When a server "listens" on a port, it means the software is standing behind that door, waiting for someone to knock.&lt;/p&gt;

&lt;h2&gt;
  
  
  The "Conflict" Rule
&lt;/h2&gt;

&lt;p&gt;On your local machine, only one process can bind to a specific port at a time.&lt;br&gt;
If you have Apache, Nginx, or another system service already listening on Port 80, your Go application will crash on startup. The OS will essentially tell you: "That door is already taken!" By using 8080, you avoid crashing into the main web services already running on your machine.&lt;/p&gt;

&lt;p&gt;The "Root" Problem (Privileged Ports)&lt;/p&gt;

&lt;p&gt;There is a second reason beginners use 8080 that is even more important: Permissions.&lt;br&gt;
In Unix-like operating systems (Linux and macOS), ports numbered 1 to 1023 are considered "Privileged Ports."&lt;br&gt;
Port 80 requires administrative (root) privileges to run.&lt;br&gt;
Port 8080 is an unprivileged port.&lt;/p&gt;

&lt;p&gt;Think of it like this:&lt;br&gt;
Door 80: Imagine this door has a "Security Clearance Required" sign. Only the "System Admin" (Root/Sudo) has the key.&lt;br&gt;
Door 8080: This is an open side entrance. Any developer (standard user) can walk through it and set up shop.&lt;/p&gt;

&lt;p&gt;As a developer, you don't want to run your Go binary with sudo every time you test a change. Using 8080 allows you to run your code as a normal user, making your development workflow much smoother and safer.&lt;/p&gt;
&lt;h2&gt;
  
  
  Why the number 8080?
&lt;/h2&gt;

&lt;p&gt;You might wonder: “Why not 1234 or 9999?”&lt;br&gt;
Technically, you could! However, 8080 became the industry standard because it literally looks like "two 80s." It’s the universal signal to other developers saying: "This is a web server, but it's for development/alternative use."&lt;/p&gt;

&lt;p&gt;A Quick Example in Go&lt;br&gt;
In case you’re wondering how this looks in code, here is how we "listen" on 8080 in Go:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="k"&gt;package&lt;/span&gt; &lt;span class="n"&gt;main&lt;/span&gt;

&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="s"&gt;"fmt"&lt;/span&gt;
    &lt;span class="s"&gt;"net/http"&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="n"&gt;main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;HandleFunc&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"/"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;func&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;w&lt;/span&gt; &lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ResponseWriter&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Request&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;fmt&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Fprintf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;w&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"Hello! You've reached the Go server on port 8080."&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;})&lt;/span&gt;

    &lt;span class="n"&gt;fmt&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Println&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Server starting on :8080..."&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="c"&gt;// We use :8080 to avoid permission issues and port conflicts&lt;/span&gt;
    &lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ListenAndServe&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;":8080"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="no"&gt;nil&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;
  
  
  Summary
&lt;/h2&gt;

&lt;p&gt;Port 80: The default for HTTP. Requires "Root" permissions.&lt;/p&gt;

&lt;p&gt;Port 8080: The "Alternative" to 80. Easy to use for development without special permissions.&lt;/p&gt;

&lt;p&gt;Understanding these small "why" questions makes the coding journey so much more rewarding. If you're just starting with Go like me, keep questioning the default`&lt;/p&gt;




&lt;p&gt;`&lt;/p&gt;

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