Today's tip: From Hello, World to hired.

Courses / Build APIs with Go / Lesson 1

1. Go in one afternoon

Every programmer starts here. In this lesson you write a complete program, run it, and change it until it does what you want.

Your first HTTP servergo
package main

import (
	"fmt"
	"net/http"
)

func main() {
	http.HandleFunc("/hello", func(w http.ResponseWriter, r *http.Request) {
		fmt.Fprintf(w, "Hello, %s!\n", r.URL.Query().Get("name"))
	})
	http.ListenAndServe(":8080", nil)
}

Your turn

Change the program so it greets you by name, then run it in the playground. The checks turn green when the output matches.

Open the playground Next lesson →