Bxog alternatives and similar packages
Based on the "Web Frameworks" category.
Alternatively, view Bxog alternatives based on common mentions on social networks and blogs.
-
Gin
Gin is a HTTP web framework written in Go (Golang). It features a Martini-like API with much better performance -- up to 40 times faster. If you need smashing performance, get yourself some Gin. -
Iris
The fastest HTTP/2 Go Web Framework. New, modern and easy to learn. Fast development with Code you control. Unbeatable cost-performance ratio :rocket: -
go-kratos
Your ultimate Go microservices framework for the cloud-native era. -
Gorilla WebSocket
A fast, well-tested and widely used WebSocket implementation for Go. -
GoFrame
GoFrame is a modular, powerful, high-performance and enterprise-class application development framework of Golang. -
go-socket.io
socket.io library for golang, a realtime application framework. -
Hertz
Go HTTP framework with high-performance and strong-extensibility for building micro-services. -
Macaron
Package macaron is a high productive and modular web framework in Go. -
Faygo
Faygo is a fast and concise Go Web framework that can be used to develop high-performance web app(especially API) with fewer codes. Just define a struct handler, faygo will automatically bind/verify the request parameters and generate the online API doc. -
render
Go package for easily rendering JSON, XML, binary data, and HTML templates responses. -
pat
Sinatra style pattern muxer for Go’s net/http library, by the author of Sinatra. -
Atreugo
High performance and extensible micro web framework. Zero memory allocations in hot paths. -
tigertonic
A Go framework for building JSON web services inspired by Dropwizard -
Goji
Goji is a minimalistic and flexible HTTP request multiplexer for Go (golang) -
fasthttprouter
A high performance fasthttp request router that scales well -
Beego
beego is an open-source, high-performance web framework for the Go programming language. -
go-server-timing
Go (golang) library for creating and consuming HTTP Server-Timing headers -
Gearbox
Gearbox :gear: is a web framework written in Go with a focus on high performance -
golongpoll
golang long polling library. Makes web pub-sub easy via HTTP long-poll servers and clients :smiley: :coffee: :computer:
Collect and Analyze Billions of Data Points in Real Time
Do you think we are missing an alternative of Bxog or a related project?
Popular Comparisons
README
Bxog is a simple and fast HTTP router for Go (HTTP request multiplexer).
Usage
An example of using the multiplexer:
package main
import (
"io"
"net/http"
bx "github.com/claygod/Bxog"
)
// Handlers
func IHandler(w http.ResponseWriter, req *http.Request, r *bx.Router) {
io.WriteString(w, "Welcome to Bxog!")
}
func THandler(w http.ResponseWriter, req *http.Request, r *bx.Router) {
params := r.Params(req, "/abc/:par")
io.WriteString(w, "Params:\n")
io.WriteString(w, " 'par' -> "+params["par"]+"\n")
}
func PHandler(w http.ResponseWriter, req *http.Request, r *bx.Router) {
// Getting parameters from URL
params := r.Params(req, "country")
io.WriteString(w, "Country:\n")
io.WriteString(w, " 'name' -> "+params["name"]+"\n")
io.WriteString(w, " 'capital' -> "+params["city"]+"\n")
io.WriteString(w, " 'valuta' -> "+params["money"]+"\n")
// Creating an URL string
io.WriteString(w, "Creating an URL from the current route (This is an example of creating an another URL):\n")
io.WriteString(w, r.Create("country", map[string]string{"name": "Russia", "city": "Moscow", "money": "rouble"}))
}
// Main
func main() {
m := bx.New()
m.Add("/", IHandler)
m.Add("/abc/:par", THandler)
m.Add("/country/:name/capital/:city/valuta/:money", PHandler).
Id("country"). // For a convinience you can indicate a short ID
Method("GET") // It is not necessary to indicate the GET method here as the GET method is used by default but this way is used to set an allowed method
m.Test()
m.Start(":9999")
}
Click URLs:
- http://localhost:9999
- http://localhost:9999/abc/123
- http://localhost:9999/country/USA/capital/Washington/valuta/dollar
Settings
Necessary changes in the configuration of the multiplexer can be made in the configuration file config.go
Perfomance
Bxog is the fastest router, showing the speed of query processing. Its speed is comparable to the speed of the popular multiplexers: Bone, Httprouter, Gorilla, Zeus. The test is done on a computer with a i3-6320 3.7GHz processor and 8 GB RAM. In short (less time, the better):
- Bxog 163 ns/op
- HttpRouter 183 ns/op
- Zeus 12302 ns/op
- GorillaMux 14928 ns/op
- GorillaPat 618 ns/op
- Bone 47333 ns/op
Detailed benchmark here
API
Methods:
- New - create a new multiplexer
- Add - add a rule specifying the handler (the default method - GET, ID - as a string to this rule)
- Start - start the server indicating the listening port
- Params - extract parameters from URL
- Create - generate URL of the available options
- Shutdown - graceful stop the server
- Stop - aggressive stop the server
- Test - Start analogue (for testing only)
Example:
m := bxog.New()
m.Add("/", IHandler)
Named parameters
Arguments in the rules designated route colon. Example route: /abc/:param , where abc is a static section and :param - the dynamic section(argument).
Static files
The directory path to the file and its nickname as part of URL specified in the configuration file. This constants FILE_PREF and FILE_PATH