πInstallation
Framework is still below 1.0.0 version. Be careful updating the package, as breaking changes are releasing pretty often. Also, documentation may still be incomplete
Just run the following command:
go get -u github.com/indigo-web/indigo@latest
For installation, go1.23.8 or higher is required
Hello, world!
Create a new package:
mkdir helloworld
cd helloworld
go mod init helloworld
go get -u github.com/indigo-web/indigo@latest
Create main.go
with the following code:
package 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)
}
}
Run the code:
go run main.go
If everything works just fine, you'll see the text Hello, world!
on the http://localhost:8080 page.
Last updated