Skip to content

flrdv/indigo

 
 

Repository files navigation

This is just a logo

Indigo is a web-framework focusing at performance, elegancy and robustness.

Documentation

Documentation is available here. It might be incomplete. In this case, feel free to open an issue.

Hello, world!

package main

import (
	"log"

	"github.com/indigo-web/indigo"
	"github.com/indigo-web/indigo/http"
	"github.com/indigo-web/indigo/router/inbuilt"
)

func HelloWorld(request *http.Request) *http.Response {
	return http.String(request, "Hello, world!")
}

func Log(request *http.Request) *http.Response {
	text, err := request.Body.String()
	if err != nil {
		return http.Error(request, err)
	}

	log.Printf("%s says: %s", request.Remote, text)
	return http.String(request, text)
}

func main() {
	r := inbuilt.New()
	r.Resource("/").
		Get(HelloWorld).
		Post(Log)

	err := indigo.New(":8080").Serve(r)
	if err != nil {
		log.Fatal(err)
	}
}

You can find more examples in examples/.

About

Indigo is a blazingly fast web-framework

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 99.9%
  • HTML 0.1%