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:
parent
60adfc8231
commit
c0b6922b52
@ -1 +1,9 @@
|
|||||||
language: go
|
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
|
||||||
|
@ -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.
|
Bolt is a fast HTTP router (zero memory allocation) + micro web framework in Go.
|
||||||
|
|
||||||
### Features
|
### Features
|
||||||
|
41
bolt.go
41
bolt.go
@ -31,16 +31,17 @@ const (
|
|||||||
HeaderContentType = "Content-Type"
|
HeaderContentType = "Content-Type"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// MethodMap is an index lookup for HTTP methods.
|
||||||
var MethodMap = map[string]uint8{
|
var MethodMap = map[string]uint8{
|
||||||
"CONNECT": 1,
|
"CONNECT": 0,
|
||||||
"DELETE": 2,
|
"DELETE": 1,
|
||||||
"GET": 3,
|
"GET": 2,
|
||||||
"HEAD": 4,
|
"HEAD": 3,
|
||||||
"OPTIONS": 5,
|
"OPTIONS": 4,
|
||||||
"PATCH": 6,
|
"PATCH": 5,
|
||||||
"POST": 7,
|
"POST": 6,
|
||||||
"PUT": 8,
|
"PUT": 7,
|
||||||
"TRACE": 9,
|
"TRACE": 8,
|
||||||
}
|
}
|
||||||
|
|
||||||
// New creates a bolt instance with options.
|
// 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) {
|
func (b *Bolt) Use(h ...HandlerFunc) {
|
||||||
b.handlers = append(b.handlers, h...)
|
b.handlers = append(b.handlers, h...)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Connect adds CONNECT route.
|
// Connect adds a CONNECT route.
|
||||||
func (b *Bolt) Connect(path string, h ...HandlerFunc) {
|
func (b *Bolt) Connect(path string, h ...HandlerFunc) {
|
||||||
b.Handle("CONNECT", path, h)
|
b.Handle("CONNECT", path, h)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete adds DELETE route.
|
// Delete adds a DELETE route.
|
||||||
func (b *Bolt) Delete(path string, h ...HandlerFunc) {
|
func (b *Bolt) Delete(path string, h ...HandlerFunc) {
|
||||||
b.Handle("DELETE", path, h)
|
b.Handle("DELETE", path, h)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get adds GET route.
|
// Get adds a GET route.
|
||||||
func (b *Bolt) Get(path string, h ...HandlerFunc) {
|
func (b *Bolt) Get(path string, h ...HandlerFunc) {
|
||||||
b.Handle("GET", path, h)
|
b.Handle("GET", path, h)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Head adds HEAD route.
|
// Head adds a HEAD route.
|
||||||
func (b *Bolt) Head(path string, h ...HandlerFunc) {
|
func (b *Bolt) Head(path string, h ...HandlerFunc) {
|
||||||
b.Handle("HEAD", path, h)
|
b.Handle("HEAD", path, h)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Options adds OPTIONS route.
|
// Options adds an OPTIONS route.
|
||||||
func (b *Bolt) Options(path string, h ...HandlerFunc) {
|
func (b *Bolt) Options(path string, h ...HandlerFunc) {
|
||||||
b.Handle("OPTIONS", path, h)
|
b.Handle("OPTIONS", path, h)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Patch adds PATCH route.
|
// Patch adds a PATCH route.
|
||||||
func (b *Bolt) Patch(path string, h ...HandlerFunc) {
|
func (b *Bolt) Patch(path string, h ...HandlerFunc) {
|
||||||
b.Handle("PATCH", path, h)
|
b.Handle("PATCH", path, h)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Post adds POST route.
|
// Post adds a POST route.
|
||||||
func (b *Bolt) Post(path string, h ...HandlerFunc) {
|
func (b *Bolt) Post(path string, h ...HandlerFunc) {
|
||||||
b.Handle("POST", path, h)
|
b.Handle("POST", path, h)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Put adds PUT route.
|
// Put adds a PUT route.
|
||||||
func (b *Bolt) Put(path string, h ...HandlerFunc) {
|
func (b *Bolt) Put(path string, h ...HandlerFunc) {
|
||||||
b.Handle("PUT", path, h)
|
b.Handle("PUT", path, h)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Trace adds TRACE route.
|
// Trace adds a TRACE route.
|
||||||
func (b *Bolt) Trace(path string, h ...HandlerFunc) {
|
func (b *Bolt) Trace(path string, h ...HandlerFunc) {
|
||||||
b.Handle("TRACE", path, h)
|
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) {
|
func (b *Bolt) Handle(method, path string, h []HandlerFunc) {
|
||||||
h = append(b.handlers, h...)
|
h = append(b.handlers, h...)
|
||||||
l := len(h)
|
l := len(h)
|
||||||
|
Loading…
Reference in New Issue
Block a user