To build websites in most programming languages, you use a framework with plenty of documentation. Go is different because it's standard library contains everything to needed build websites. Unfortunately, this means that the documentation specific to build websites is minimal.
This website aims to bridge that gap by providing code examples and explanations for different design decisions.
And the code for this website is public on GitHub. It serves as an example of what it looks like to run Go in production.
Like the Supermoto motorcycles that easily transition from dirt jumps to asphalt racing, this website enables developers to create websites capable of handling diverse challenges.
The name Supermoto also allows for quick search engine queries like a framework. "go supermoto templates" should make this website show up at the top search results.
This website is part of a capstone by Jackson Lohman for an Integrated Studies degree at Utah Valley University. To learn more, read the paper: Understanding Go Web Framework Popularity and Enabling Standard Library Adoption Through Practical Examples
Here is what it looks like to return Hello World! in Go:
package main
import (
"fmt"
"net/http"
)
func main() {
// Make a router. (Often called a multiplexer in Go)
mux := http.NewServeMux()
// Define a handler to run if a request to the webserver
mux.HandleFunc("/hello", helloHandler)
// This runs on the specified port with the router we defined above
http.ListenAndServe(":8000", mux)
}
func helloHandler(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "Helloooooooooooooo World!")
}
If you are new to Go, the Getting started section is a good place to start.
Otherwise, pick a section in the right nav to learn more about a specific topic.