1
0
mirror of https://github.com/labstack/echo.git synced 2024-12-24 20:14:31 +02:00

New badges

Signed-off-by: Vishal Rana <vr@labstack.com>
This commit is contained in:
Vishal Rana 2015-03-16 14:38:40 -07:00
parent 60adfc8231
commit c0b6922b52
3 changed files with 30 additions and 21 deletions

View File

@ -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

View File

@ -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

41
bolt.go
View File

@ -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.
@ -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)