Go 2

How to run simple http server in Go

Issue #220

Handle url parameter

package main

import (
  "net/http"
  "log"
)

func handleGreeting(w http.ResponseWriter, r *http.Request) {
  messages, ok := r.URL.Query()["message"]
    
  if !ok || len(messages[0]) < 1 { …

How to parse json in Go

Issue #199

Unmarshal using encoding/json

  • property in struct needs to be first letter capitalized
import (
	"net/http"
	"encoding/json"
	"io/ioutil"
	"fmt"
)

type MyJsonObject struct {
	Id string `json:"id"` …