An ultra-minimalist and experimental Go web framework prioritising developer experience and expressiveness.
go get github.com/ashtonjamesd/alliumpackage main
import . "github.com/ashtonjamesd/allium"
func Index(_ Ctx) Res {
return Ok("Hello, World!")
}
func main() {
// initialise a web app
App().
// register an endpoint
Get(Index).
// run the app
Run()
}You can also create a reference to app instead of using a fluent interface.
package main
import . "github.com/ashtonjamesd/allium"
func Index(_ Ctx) Res {
return Ok("Hello, World!")
}
func main() {
app := App()
app.Get(Index)
app.Run()
}The app defaults to port 3000. To change this, use the port method.
app.Port(3000)The App method also supports an optional port parameter as an alternative to using Port.
Routing in Allium is intentionally reflective. The names of your controllers can be used to implicitly define behaviour, reducing boilerplate and improving readability.
Using app.Do, Allium automatically infers the HTTP method from the controller name. For example, any function whose name begins with 'get' (case-insensitive) is registered as a GET route:
app.Do(GetPerson)The following example registers two GET routes, a POST, a DELETE, and a PATCH, purely based on naming conventions:
app.Do(
GetPerson,
GetPeople,
CreatePerson,
DeletePerson,
UpdatePerson,
)See /doc for more information on middleware, environment variables, etc.
To experiment with a framework focused on developer experience and speed in tandem with Go's fast compile times. I also wanted to learn Go.