Skip to content

indigo-web/indigo

Repository files navigation

indigo

image

Elegance, conciseness, flexibility and extensibility — that’s what Indigo is about. The goal is to create a mini ecosystem in which you can focus on actual tasks rather than reimplementing the same things over and over again. Everything you need to get started is already included, and whatever isn’t is trivially pluggable.

FastHTTP-grade performance, stream-based body processing, fine-tuning of nearly every parameter — including memory consumption control — and a full-fledged built-in router are the icing on the cake.

Documentation

Documentation is available here. It might be incomplete however, feel free to open issues.

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/.

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •