Fork me on GitHub

Stackr Build Status

WARNING: UNSTABLE API

Stackr is an extensible HTTP server framework for Go, shipping with over 2 bundled middleware and a poor selection of 3rd-party middleware.

Install

go get github.com/ricallinson/stackr

Write Code

package main

import "github.com/ricallinson/stackr"

func main() {
    app := stackr.CreateServer()
    app.Use(stackr.Logger())
    app.Use(stackr.Static())
    app.Use("/", func(req *stackr.Request, res *stackr.Response, next func()) {
        res.End("hello world\n")
    })
    app.Listen(3000)
}

Use Middleware

Make Middleware

func MyMiddleware() (func(req *Request, res *Response, next func())) {
    // Prep
    return func(req *Request, res *Response, next func()) {
        // Process
    })
})