πInstallation
First things first, huh?
go get -u github.com/indigo-web/indigo@latestHello, world!
mkdir helloworld
cd helloworld
go mod init helloworld
go get -u github.com/indigo-web/indigo@latestpackage main
import (
"log"
"github.com/indigo-web/indigo"
"github.com/indigo-web/indigo/http"
"github.com/indigo-web/indigo/router/inbuilt"
)
func Hello(request *http.Request) *http.Response {
return http.String(request, "Hello, world!")
}
func main() {
r := inbuilt.New()
r.Get("/", Hello)
err := indigo.New(":8080").Serve(r)
if err != nil {
log.Fatal(err)
}
}Last updated