Learning Go is exciting. Decided to see how to set up a Web Application or API using Go language along with FastAPI implementation.

package main

import (

// Define a home handler function
func home(w http.ResponseWriter, r *http.Request) {
	w.Write([]byte("Hello from Goooooo"))

func main() {
// http.NewServeMux() function to initialize a new servemux
	mux := http.NewServeMux()

// match "/" URL pattern with home handler function
	mux.HandleFunc("/", home)

// http.ListenAndServe() function to start a new web server
  err := http.ListenAndServe(":4000", mux)

As usual: “go run .

Here we gooooo:

go web app browser

in servemux the pattern "/" = a catch-all.