Skip to content

Commit

Permalink
New badges
Browse files Browse the repository at this point in the history
Signed-off-by: Vishal Rana <[email protected]>
  • Loading branch information
vishr committed Mar 16, 2015
1 parent 60adfc8 commit c0b6922
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 21 deletions.
8 changes: 8 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1 +1,9 @@
language: go
go:
- tip
before_install:
- go get github.com/axw/gocov/gocov
- go get github.com/mattn/goveralls
- go get golang.org/x/tools/cmd/cover
script:
- $HOME/gopath/bin/goveralls -service=travis-ci
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Bolt [![Build Status](https://travis-ci.org/labstack/bolt.svg?branch=master)](https://travis-ci.org/labstack/bolt)
# Bolt [![GoDoc](http://img.shields.io/badge/go-documentation-blue.svg?style=flat-square)](http://godoc.org/github.com/labstack/bolt) [![Build Status](http://img.shields.io/travis/fatih/structs.svg?style=flat-square)](https://travis-ci.org/labstack/bolt) [![Coverage Status](http://img.shields.io/coveralls/labstack/bolt.svg?style=flat-square)](https://coveralls.io/r/labstack/bolt)
Bolt is a fast HTTP router (zero memory allocation) + micro web framework in Go.

### Features
Expand Down
41 changes: 21 additions & 20 deletions bolt.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,17 @@ const (
HeaderContentType = "Content-Type"
)

// MethodMap is an index lookup for HTTP methods.
var MethodMap = map[string]uint8{
"CONNECT": 1,
"DELETE": 2,
"GET": 3,
"HEAD": 4,
"OPTIONS": 5,
"PATCH": 6,
"POST": 7,
"PUT": 8,
"TRACE": 9,
"CONNECT": 0,
"DELETE": 1,
"GET": 2,
"HEAD": 3,
"OPTIONS": 4,
"PATCH": 5,
"POST": 6,
"PUT": 7,
"TRACE": 8,
}

// New creates a bolt instance with options.
Expand Down Expand Up @@ -111,57 +112,57 @@ func InternalServerErrorHandler(h HandlerFunc) Option {
}
}

// Use adds middleware(s) to the chain.
// Use adds middleware to the chain.
func (b *Bolt) Use(h ...HandlerFunc) {
b.handlers = append(b.handlers, h...)
}

// Connect adds CONNECT route.
// Connect adds a CONNECT route.
func (b *Bolt) Connect(path string, h ...HandlerFunc) {
b.Handle("CONNECT", path, h)
}

// Delete adds DELETE route.
// Delete adds a DELETE route.
func (b *Bolt) Delete(path string, h ...HandlerFunc) {
b.Handle("DELETE", path, h)
}

// Get adds GET route.
// Get adds a GET route.
func (b *Bolt) Get(path string, h ...HandlerFunc) {
b.Handle("GET", path, h)
}

// Head adds HEAD route.
// Head adds a HEAD route.
func (b *Bolt) Head(path string, h ...HandlerFunc) {
b.Handle("HEAD", path, h)
}

// Options adds OPTIONS route.
// Options adds an OPTIONS route.
func (b *Bolt) Options(path string, h ...HandlerFunc) {
b.Handle("OPTIONS", path, h)
}

// Patch adds PATCH route.
// Patch adds a PATCH route.
func (b *Bolt) Patch(path string, h ...HandlerFunc) {
b.Handle("PATCH", path, h)
}

// Post adds POST route.
// Post adds a POST route.
func (b *Bolt) Post(path string, h ...HandlerFunc) {
b.Handle("POST", path, h)
}

// Put adds PUT route.
// Put adds a PUT route.
func (b *Bolt) Put(path string, h ...HandlerFunc) {
b.Handle("PUT", path, h)
}

// Trace adds TRACE route.
// Trace adds a TRACE route.
func (b *Bolt) Trace(path string, h ...HandlerFunc) {
b.Handle("TRACE", path, h)
}

// Handle adds method, path and handler to the router.
// Handle adds method, path handler to the router.
func (b *Bolt) Handle(method, path string, h []HandlerFunc) {
h = append(b.handlers, h...)
l := len(h)
Expand Down

0 comments on commit c0b6922

Please sign in to comment.