Ion Web Framework

GoDoc Build Status Codecov Go Report Card

Ion is a small web framework written in Go.

Ion leverages component composition to allow functionality reuse, and build complex behaviors based on simple components.

A short example

package main

import (
	"fmt"
	"github.com/estebarb/ion"
	"net/http"
)

func newApp() http.Handler {
	routes := ion.Routes{
		"/:name": {
			Middleware:  []ion.Middleware{ion.PathEnd},
			HttpHandler: http.HandlerFunc(hello),
		},
	}
	return routes.Build()
}

func hello(w http.ResponseWriter, r *http.Request) {
	name := r.Context().Value("name")
	if name != "" {
		fmt.Fprintf(w, "Hello, %v!", name)
	} else {
		fmt.Fprint(w, "Hello world!")
	}
}

func main() {
	app := newApp()
	http.ListenAndServe(":5500", app)
}

WARNING: At this point the framework is highly experimental, so please take that in consideration if you want to use it.

License

Ion is released under the MIT License, as specified in LICENSE.