Stack is an extensible HTTP server framework for Go
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
fixtures
reports
.gitignore
.travis.yml
README.md
error_handler.go
error_handler_test.go
favicon.go
favicon_test.go
logger.go
logger_test.go
method_override.go
method_override_test.go
mocks_test.go
request.go
request_test.go
response.go
response_test.go
response_time.go
response_time_test.go
stackr.go
stackr_benchmark_test.go
stackr_test.go
static.go
static_test.go

README.md

Stackr

Build Status

WARNING: UNSTABLE API

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

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

Middleware

  • ErrorHandler flexible error handler
  • Favicon efficient favicon server
  • Logger request logger with custom format support
  • ResponseTime calculates response-time and exposes via X-Response-Time
  • MethodOverride faux HTTP method support
  • Static static file server currently based on http.FileServer

Testing

The following should all be executed from the stackr directory $GOPATH/src/github.com/ricallinson/stackr/.

Install

go get github.com/ricallinson/simplebdd

Run

go test

Code Coverage

Install

go get github.com/axw/gocov/gocov
go get -u github.com/matm/gocov-html

Generate

gocov test | gocov-html > ./reports/coverage.html

Notes

This project started out as a clone of the superb Node.js library Connect.