{"id":228,"date":"2026-04-17T09:00:00","date_gmt":"2026-04-17T03:30:00","guid":{"rendered":"https:\/\/smitabharat.com\/blog\/?p=228"},"modified":"2026-10-10T21:20:49","modified_gmt":"2026-10-10T15:50:49","slug":"go-http-server-beginners","status":"publish","type":"post","link":"https:\/\/smitabharat.com\/blog\/go-http-server-beginners\/","title":{"rendered":"Go HTTP Server: Build Your First Web Server"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">A Go HTTP server can run with just a few lines of code. That is because the standard library already includes a fast, production-ready web server. In this post, you will build one step by step, with routes, path values, status codes and middleware. Each idea comes with code that you can run and test yourself.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Every request runs in its own goroutine, which you learned about in <a href=\"https:\/\/smitabharat.com\/blog\/go-goroutines-beginners-guide\/\">goroutines in Go for beginners<\/a>. Handlers are also just functions, so a quick look at <a href=\"https:\/\/smitabharat.com\/blog\/go-functions-beginners-guide\/\">writing and calling functions in Go<\/a> helps too.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">What Is a Go HTTP Server?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">To start, a web server waits for requests from browsers or apps and sends back responses. In addition, HTTP is the set of rules they use to talk. In Go, the <code>net\/http<\/code> package gives you everything you need, with no framework required.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For example, think of a restaurant counter. A customer places an order, the counter sends it to the right cook, and the cook returns a dish. Similarly, a Go HTTP server routes each request to the right function and returns a response.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Your First Go HTTP Server<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>package main\n\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"net\/http\"\n)\n\nfunc helloHandler(w http.ResponseWriter, r *http.Request) {\n\tname := r.URL.Query().Get(\"name\")\n\tif name == \"\" {\n\t\tname = \"Go\"\n\t}\n\tfmt.Fprintf(w, \"Hello, %s!\", name)\n}\n\nfunc main() {\n\tmux := http.NewServeMux()\n\tmux.HandleFunc(\"GET \/hello\", helloHandler)\n\n\tfmt.Println(\"Server running on http:\/\/localhost:8080\")\n\tlog.Fatal(http.ListenAndServe(\":8080\", mux))\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Run it with <code>go run .<\/code> and open <code>http:\/\/localhost:8080\/hello<\/code> in your browser. As a result, you will see &#8220;Hello, Go!&#8221;. Then <code>ListenAndServe<\/code> keeps the program running until you press Ctrl+C.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Handlers: w and r<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Every handler gets two things. First, <code>r<\/code> is the request, holding the URL, method, headers and body. Second, <code>w<\/code> is the response writer, where you write what the user receives.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Routing Requests in a Go HTTP Server<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Next, a ServeMux, short for request multiplexer, matches each incoming URL to a handler. The diagram below shows a request travelling through the server.<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"640\" src=\"https:\/\/smitabharat.com\/blog\/wp-content\/uploads\/2026\/10\/go-http-server-beginners-diagram-1024x640.png\" alt=\"Go HTTP Server diagram showing a request passing through middleware and ServeMux to a handler\" class=\"wp-image-230\" srcset=\"https:\/\/smitabharat.com\/blog\/wp-content\/uploads\/2026\/10\/go-http-server-beginners-diagram-1024x640.png 1024w, https:\/\/smitabharat.com\/blog\/wp-content\/uploads\/2026\/10\/go-http-server-beginners-diagram-300x188.png 300w, https:\/\/smitabharat.com\/blog\/wp-content\/uploads\/2026\/10\/go-http-server-beginners-diagram-768x480.png 768w, https:\/\/smitabharat.com\/blog\/wp-content\/uploads\/2026\/10\/go-http-server-beginners-diagram-1536x960.png 1536w, https:\/\/smitabharat.com\/blog\/wp-content\/uploads\/2026\/10\/go-http-server-beginners-diagram-2048x1280.png 2048w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><em>The browser sends a request, middleware logs it, the ServeMux picks a handler, and the handler writes the response.<\/em><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Methods and Path Values<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>func userHandler(w http.ResponseWriter, r *http.Request) {\n\tid := r.PathValue(\"id\")\n\tfmt.Fprintf(w, \"User ID: %s\", id)\n}\n\nmux.HandleFunc(\"GET \/users\/{id}\", userHandler)\n\/\/ GET \/users\/42  -&gt;  User ID: 42<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Since Go 1.22, a pattern can include the HTTP method and named parts like <code>{id}<\/code>. Then <code>r.PathValue(\"id\")<\/code> reads that part. Also, a POST to a GET-only route returns 405 Method Not Allowed for free.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Reading Query Parameters<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">In addition, query parameters come after the <code>?<\/code> in a URL. For example, <code>\/hello?name=Smita<\/code> makes <code>r.URL.Query().Get(\"name\")<\/code> return &#8220;Smita&#8221;, so the page says &#8220;Hello, Smita!&#8221;.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Status Codes and Headers<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>mux.HandleFunc(\"GET \/health\", func(w http.ResponseWriter, r *http.Request) {\n\tw.Header().Set(\"Content-Type\", \"text\/plain\")\n\tw.WriteHeader(http.StatusOK)\n\tw.Write(&#91;]byte(\"ok\"))\n})<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Similarly, a status code tells the client how things went, such as 200 OK or 404 Not Found. Set headers first, then the status, and finally write the body. That order matters, because the status and headers go out with the first write.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Middleware: Code That Runs on Every Request<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>func logging(next http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tstart := time.Now()\n\t\tnext.ServeHTTP(w, r)\n\t\tlog.Printf(\"%s %s %v\", r.Method, r.URL.Path, time.Since(start).Round(time.Millisecond))\n\t})\n}\n\nlog.Fatal(http.ListenAndServe(\":8080\", logging(mux)))\n\/\/ 2026\/10\/03 22:32:40 GET \/users\/42 0s<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Middleware wraps a handler with extra work, like logging, login checks or timing. In short, it is a function that takes a handler and returns a new one.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Testing Your Go HTTP Server<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>curl localhost:8080\/hello              # Hello, Go!\ncurl \"localhost:8080\/hello?name=Smita\" # Hello, Smita!\ncurl localhost:8080\/users\/42           # User ID: 42\ncurl -i -X POST localhost:8080\/hello   # HTTP\/1.1 405 Method Not Allowed<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The <code>curl<\/code> tool sends requests from your terminal to your Go HTTP server. Add <code>-i<\/code> to see the status line and headers too.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Common Mistakes with a Go HTTP Server<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Error you see<\/th><th>Why it happens<\/th><th>How to fix it<\/th><\/tr><\/thead><tbody><tr><td>listen tcp :8080: bind: address already in use<\/td><td>Another program uses port 8080.<\/td><td>Stop it or pick another port.<\/td><\/tr><tr><td>http: superfluous response.WriteHeader call<\/td><td>WriteHeader ran after the body was written.<\/td><td>Set the status before writing.<\/td><\/tr><tr><td>Handler keeps running after an error<\/td><td>The code forgot return after http.Error.<\/td><td>Always return right after it.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">In particular, the missing return is sneaky, because the user may get two messages glued together. Web server questions also appear in my <a href=\"https:\/\/smitabharat.com\/blog\/go-lang-interview-questions-and-answers\/\">Go interview questions and answers<\/a>, so try them next.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Official Resources<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">These pages come straight from the Go team, so they are always accurate and up to date.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/pkg.go.dev\/net\/http\">net\/http package documentation<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/go.dev\/blog\/routing-enhancements\">Go blog: Routing Enhancements for Go 1.22<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/go.dev\/doc\/articles\/wiki\/\">Go docs: Writing Web Applications<\/a><\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Quick Recap<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>A Go HTTP server needs only the net\/http package.<\/li>\n\n\n\n<li>Handlers take a ResponseWriter and a Request.<\/li>\n\n\n\n<li>ServeMux routes &#8220;GET \/users\/{id}&#8221; style patterns, and PathValue reads the parts.<\/li>\n\n\n\n<li>Set headers, then status, then write the body.<\/li>\n\n\n\n<li>Middleware wraps handlers to add logging or checks.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">What&#8217;s Next?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Your server can now answer requests. Next, we will combine it with JSON to build a complete REST API.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Coming soon: Go REST API Tutorial for Beginners<\/p>\n","protected":false},"excerpt":{"rendered":"<p>A Go HTTP server can run with just a few lines of code. That is because the standard library already includes a fast, production-ready&hellip;<\/p>\n","protected":false},"author":1,"featured_media":229,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_swapz_level":"","_swapz_series_part":0,"_swapz_hide_toc":false,"_swapz_hide_featured":false,"_swapz_description":"","footnotes":""},"categories":[15],"tags":[44,11,23,21],"swapz_series":[],"class_list":["post-228","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-go-lang","tag-go-http-server","tag-go-lang","tag-go-tutorial","tag-golang-basics"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.9 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Go HTTP Server: Build Your First Web Server<\/title>\n<meta name=\"description\" content=\"Build a Go HTTP server with net\/http: handlers, routing with ServeMux, path values, status codes, middleware and common mistakes.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/smitabharat.com\/blog\/go-http-server-beginners\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Go HTTP Server: Build Your First Web Server\" \/>\n<meta property=\"og:description\" content=\"Build a Go HTTP server with net\/http: handlers, routing with ServeMux, path values, status codes, middleware and common mistakes.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/smitabharat.com\/blog\/go-http-server-beginners\/\" \/>\n<meta property=\"og:site_name\" content=\"Smita Bharat - Blog\" \/>\n<meta property=\"article:published_time\" content=\"2026-04-17T03:30:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-10-10T15:50:49+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/smitabharat.com\/blog\/wp-content\/uploads\/2026\/10\/go-http-server-beginners-featured.png\" \/>\n\t<meta property=\"og:image:width\" content=\"2400\" \/>\n\t<meta property=\"og:image:height\" content=\"1260\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Smita\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Smita\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/go-http-server-beginners\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/go-http-server-beginners\\\/\"},\"author\":{\"name\":\"Smita\",\"@id\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/#\\\/schema\\\/person\\\/27a1b1067d396703215c54acedbfd339\"},\"headline\":\"Go HTTP Server: Build Your First Web Server\",\"datePublished\":\"2026-04-17T03:30:00+00:00\",\"dateModified\":\"2026-10-10T15:50:49+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/go-http-server-beginners\\\/\"},\"wordCount\":677,\"publisher\":{\"@id\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/#\\\/schema\\\/person\\\/27a1b1067d396703215c54acedbfd339\"},\"image\":{\"@id\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/go-http-server-beginners\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/10\\\/go-http-server-beginners-featured.png\",\"keywords\":[\"Go HTTP Server\",\"Go Lang\",\"Go Tutorial\",\"Golang Basics\"],\"articleSection\":[\"Go Lang\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/go-http-server-beginners\\\/\",\"url\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/go-http-server-beginners\\\/\",\"name\":\"Go HTTP Server: Build Your First Web Server\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/go-http-server-beginners\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/go-http-server-beginners\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/10\\\/go-http-server-beginners-featured.png\",\"datePublished\":\"2026-04-17T03:30:00+00:00\",\"dateModified\":\"2026-10-10T15:50:49+00:00\",\"description\":\"Build a Go HTTP server with net\\\/http: handlers, routing with ServeMux, path values, status codes, middleware and common mistakes.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/go-http-server-beginners\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/smitabharat.com\\\/blog\\\/go-http-server-beginners\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/go-http-server-beginners\\\/#primaryimage\",\"url\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/10\\\/go-http-server-beginners-featured.png\",\"contentUrl\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/10\\\/go-http-server-beginners-featured.png\",\"width\":2400,\"height\":1260,\"caption\":\"Go HTTP Server featured image: cards showing a handler, a route pattern and middleware\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/go-http-server-beginners\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Go HTTP Server: Build Your First Web Server\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/\",\"name\":\"Smita Bharat Blog\",\"description\":\"Golang &amp; Backend Development Tutorials and Interview Questions\",\"publisher\":{\"@id\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/#\\\/schema\\\/person\\\/27a1b1067d396703215c54acedbfd339\"},\"alternateName\":\"Smita Bharat\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/#\\\/schema\\\/person\\\/27a1b1067d396703215c54acedbfd339\",\"name\":\"Smita\",\"logo\":{\"@id\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/#\\\/schema\\\/person\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/smitabharat.com\\\/blog\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Go HTTP Server: Build Your First Web Server","description":"Build a Go HTTP server with net\/http: handlers, routing with ServeMux, path values, status codes, middleware and common mistakes.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/smitabharat.com\/blog\/go-http-server-beginners\/","og_locale":"en_US","og_type":"article","og_title":"Go HTTP Server: Build Your First Web Server","og_description":"Build a Go HTTP server with net\/http: handlers, routing with ServeMux, path values, status codes, middleware and common mistakes.","og_url":"https:\/\/smitabharat.com\/blog\/go-http-server-beginners\/","og_site_name":"Smita Bharat - Blog","article_published_time":"2026-04-17T03:30:00+00:00","article_modified_time":"2026-10-10T15:50:49+00:00","og_image":[{"width":2400,"height":1260,"url":"https:\/\/smitabharat.com\/blog\/wp-content\/uploads\/2026\/10\/go-http-server-beginners-featured.png","type":"image\/png"}],"author":"Smita","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Smita","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/smitabharat.com\/blog\/go-http-server-beginners\/#article","isPartOf":{"@id":"https:\/\/smitabharat.com\/blog\/go-http-server-beginners\/"},"author":{"name":"Smita","@id":"https:\/\/smitabharat.com\/blog\/#\/schema\/person\/27a1b1067d396703215c54acedbfd339"},"headline":"Go HTTP Server: Build Your First Web Server","datePublished":"2026-04-17T03:30:00+00:00","dateModified":"2026-10-10T15:50:49+00:00","mainEntityOfPage":{"@id":"https:\/\/smitabharat.com\/blog\/go-http-server-beginners\/"},"wordCount":677,"publisher":{"@id":"https:\/\/smitabharat.com\/blog\/#\/schema\/person\/27a1b1067d396703215c54acedbfd339"},"image":{"@id":"https:\/\/smitabharat.com\/blog\/go-http-server-beginners\/#primaryimage"},"thumbnailUrl":"https:\/\/smitabharat.com\/blog\/wp-content\/uploads\/2026\/10\/go-http-server-beginners-featured.png","keywords":["Go HTTP Server","Go Lang","Go Tutorial","Golang Basics"],"articleSection":["Go Lang"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/smitabharat.com\/blog\/go-http-server-beginners\/","url":"https:\/\/smitabharat.com\/blog\/go-http-server-beginners\/","name":"Go HTTP Server: Build Your First Web Server","isPartOf":{"@id":"https:\/\/smitabharat.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/smitabharat.com\/blog\/go-http-server-beginners\/#primaryimage"},"image":{"@id":"https:\/\/smitabharat.com\/blog\/go-http-server-beginners\/#primaryimage"},"thumbnailUrl":"https:\/\/smitabharat.com\/blog\/wp-content\/uploads\/2026\/10\/go-http-server-beginners-featured.png","datePublished":"2026-04-17T03:30:00+00:00","dateModified":"2026-10-10T15:50:49+00:00","description":"Build a Go HTTP server with net\/http: handlers, routing with ServeMux, path values, status codes, middleware and common mistakes.","breadcrumb":{"@id":"https:\/\/smitabharat.com\/blog\/go-http-server-beginners\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/smitabharat.com\/blog\/go-http-server-beginners\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/smitabharat.com\/blog\/go-http-server-beginners\/#primaryimage","url":"https:\/\/smitabharat.com\/blog\/wp-content\/uploads\/2026\/10\/go-http-server-beginners-featured.png","contentUrl":"https:\/\/smitabharat.com\/blog\/wp-content\/uploads\/2026\/10\/go-http-server-beginners-featured.png","width":2400,"height":1260,"caption":"Go HTTP Server featured image: cards showing a handler, a route pattern and middleware"},{"@type":"BreadcrumbList","@id":"https:\/\/smitabharat.com\/blog\/go-http-server-beginners\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/smitabharat.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Go HTTP Server: Build Your First Web Server"}]},{"@type":"WebSite","@id":"https:\/\/smitabharat.com\/blog\/#website","url":"https:\/\/smitabharat.com\/blog\/","name":"Smita Bharat Blog","description":"Golang &amp; Backend Development Tutorials and Interview Questions","publisher":{"@id":"https:\/\/smitabharat.com\/blog\/#\/schema\/person\/27a1b1067d396703215c54acedbfd339"},"alternateName":"Smita Bharat","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/smitabharat.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/smitabharat.com\/blog\/#\/schema\/person\/27a1b1067d396703215c54acedbfd339","name":"Smita","logo":{"@id":"https:\/\/smitabharat.com\/blog\/#\/schema\/person\/image\/"},"sameAs":["https:\/\/smitabharat.com\/blog"]}]}},"_links":{"self":[{"href":"https:\/\/smitabharat.com\/blog\/wp-json\/wp\/v2\/posts\/228","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/smitabharat.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/smitabharat.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/smitabharat.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/smitabharat.com\/blog\/wp-json\/wp\/v2\/comments?post=228"}],"version-history":[{"count":1,"href":"https:\/\/smitabharat.com\/blog\/wp-json\/wp\/v2\/posts\/228\/revisions"}],"predecessor-version":[{"id":231,"href":"https:\/\/smitabharat.com\/blog\/wp-json\/wp\/v2\/posts\/228\/revisions\/231"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/smitabharat.com\/blog\/wp-json\/wp\/v2\/media\/229"}],"wp:attachment":[{"href":"https:\/\/smitabharat.com\/blog\/wp-json\/wp\/v2\/media?parent=228"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/smitabharat.com\/blog\/wp-json\/wp\/v2\/categories?post=228"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/smitabharat.com\/blog\/wp-json\/wp\/v2\/tags?post=228"},{"taxonomy":"swapz_series","embeddable":true,"href":"https:\/\/smitabharat.com\/blog\/wp-json\/wp\/v2\/swapz_series?post=228"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}