Skip to content

ashtonjamesd/allium

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Allium

An ultra-minimalist and experimental Go web framework prioritising developer experience and expressiveness.

Installation

go get github.com/ashtonjamesd/allium

Quick Start

package 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()
}

Configuration

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

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.

Why?

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.

About

a minimalist go web framework

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages