import "github.com/estebarb/ion"
Package ion implements a small web framework that allows to easily connect reusable components.
This framework is based on https://blog.gopheracademy.com/advent-2016/go-syntax-for-dsls/ idea of using a DSL. This approach naturally removes the need to implement a router, allowing the framework to just reuse Go standard mux.
Ion have the following features:
- Can use easily any http.Handler or http.HandlerFunc - Easily describe paths (with arguments) and method handlers - Compatible with Middlewares - Use context for passing path arguments
PathEnd is a middleware used to "cut" the requests path at the current level. The request is handled if the path is "/" or "".
Builder interface is implemented by objects that can be build into an http.Handler
type Chain []Middleware
Chain describes a secuence of Middleware
Then composes all the middlewares wrapping the given http.Handler, and returns a new http.Handler
type Endpoint struct { Middleware []Middleware Handler Builder HttpHandler http.Handler }
Endpoint describes a http request handler, that may have optional Middleware
Build generates an http.Handler from an Endpoint
Methods implement an http.Handler that handles requests according to the request method.
Build generates an http.Handler
Middleware is a function that wrap an http.Handler and returns a value that implements the http.Handler interface
Routes describe a request router that handles request according to its path
Build returns an http.Handler that can handle requests by path
Path | Synopsis |
---|---|
components/resource | |
components/router | Package router contains a flexible router, with integrated context management per request |
examples/hello | |
futures | Package futures allow adding incomplete computations in contexts and templates. |
middleware | Package middleware contains general purpose middleware. |
middleware/hotcache | Package hotcache intercepts and group equal requests, perform a single server request. |
Package ion imports 4 packages (graph) and is imported by 2 packages. Updated 2020-05-23. Refresh now. Tools for package owners.