All Projects → go-zoo → Bone

go-zoo / Bone

Licence: mit
Lightning Fast HTTP Multiplexer

Programming Languages

go
31211 projects - #10 most used programming language

Labels

Projects that are alternatives of or similar to Bone

rux
⚡ Rux is an simple and fast web framework. support route group, param route binding, middleware, compatible http.Handler interface. 简单且快速的 Go api/web 框架,支持路由分组,路由参数绑定,中间件,兼容 http.Handler 接口
Stars: ✭ 81 (-93.62%)
Mutual labels:  router, mux
Mux
A powerful HTTP router and URL matcher for building Go web servers with 🦍
Stars: ✭ 15,667 (+1133.62%)
Mutual labels:  mux, router
Httprouter
A high performance HTTP request router that scales well
Stars: ✭ 13,500 (+962.99%)
Mutual labels:  mux, router
Mux
A high performance and powerful trie based url path router for Go.
Stars: ✭ 487 (-61.65%)
Mutual labels:  mux, router
Highway
Highway - A Modern Javascript Transitions Manager
Stars: ✭ 1,185 (-6.69%)
Mutual labels:  router
Flowa
🔥Service level control flow for Node.js
Stars: ✭ 66 (-94.8%)
Mutual labels:  router
Dorado
基于Netty4开发的简单、轻量级、高性能的的Http restful api server
Stars: ✭ 65 (-94.88%)
Mutual labels:  router
Ng2 Breadcrumbs
A breadcrumb service for the Angular 7 router
Stars: ✭ 61 (-95.2%)
Mutual labels:  router
Lit Element Router
A LitElement Router (1278 bytes gzip)
Stars: ✭ 85 (-93.31%)
Mutual labels:  router
Hookrouter
The flexible, and fast router for react that is entirely based on hooks
Stars: ✭ 1,200 (-5.51%)
Mutual labels:  router
Service Worker Router
➰ An elegant and fast URL router for service workers (and standalone use)
Stars: ✭ 70 (-94.49%)
Mutual labels:  router
Actions Openwrt K2p
Use Github Actions to automatically compile Lean's Modified Lede source for K2P
Stars: ✭ 67 (-94.72%)
Mutual labels:  router
Nettygateway
NettyGateway is a HTTP proxy server with flexible routing rules.
Stars: ✭ 73 (-94.25%)
Mutual labels:  router
Route Recognizer
Recognizes URL patterns with support for dynamic and wildcard segments
Stars: ✭ 65 (-94.88%)
Mutual labels:  router
Drouter
Android Router Framework
Stars: ✭ 80 (-93.7%)
Mutual labels:  router
Ngqp
Declaratively synchronize form controls with the URL
Stars: ✭ 65 (-94.88%)
Mutual labels:  router
Corenavigation
📱📲 Navigate between view controllers with ease. 💫 🔜 More stable version (written in Swift 5) coming soon.
Stars: ✭ 69 (-94.57%)
Mutual labels:  router
Single Spa
The router for easy microfrontends
Stars: ✭ 10,395 (+718.5%)
Mutual labels:  router
Koatty
Koa2 + Typescript = Koatty. Use Typescript's decorator implement IOC and AOP.
Stars: ✭ 67 (-94.72%)
Mutual labels:  router
Livebox 0day
Arcadyan ARV7519RW22-A-L T VR9 1.2 Multiple security vulnerabilities affecting latest firmware release on ORANGE Livebox modems.
Stars: ✭ 68 (-94.65%)
Mutual labels:  router

bone GoDoc Build Status Go Report Card

What is bone ?

Bone is a lightweight and lightning fast HTTP Multiplexer for Golang. It support :

  • URL Parameters
  • REGEX Parameters
  • Wildcard routes
  • Router Prefix
  • Route params validators
  • Sub Router, mux.SubRoute(), support most standard router (bone, gorilla/mux, httpRouter etc...)
  • Http method declaration
  • Support for http.Handler and http.HandlerFunc
  • Custom NotFound handler
  • Respect the Go standard http.Handler interface

alt tag

Speed

- BenchmarkBoneMux        10000000               118 ns/op
- BenchmarkZeusMux          100000               144 ns/op
- BenchmarkHttpRouterMux  10000000               134 ns/op
- BenchmarkNetHttpMux      3000000               580 ns/op
- BenchmarkGorillaMux       300000              3333 ns/op
- BenchmarkGorillaPatMux   1000000              1889 ns/op

These tests are just for fun, all these routers are great and efficient. Bone isn't the fastest router for every job.

Example


package main

import(
  "net/http"

  "github.com/go-zoo/bone"
)

func main () {
  mux := bone.New()

  mux.RegisterValidatorFunc("isNum", func(s string) bool {
    if _, err := strconv.Atoi(s); err == nil {
      return true
    }
    return false
  })

  // mux.Get, Post, etc ... takes http.Handler
  // validator for route parameter
  mux.Get("/home/:id|isNum", http.HandlerFunc(HomeHandler))
  // multiple parameter
  mux.Get("/profil/:id/:var", http.HandlerFunc(ProfilHandler))
  mux.Post("/data", http.HandlerFunc(DataHandler))

  // Support REGEX Route params
  mux.Get("/index/#id^[0-9]$", http.HandlerFunc(IndexHandler))

  // Handle take http.Handler
  mux.Handle("/", http.HandlerFunc(RootHandler))

  // GetFunc, PostFunc etc ... takes http.HandlerFunc
  mux.GetFunc("/test", Handler)

  http.ListenAndServe(":8080", mux)
}

func Handler(rw http.ResponseWriter, req *http.Request) {
  // Get the value of the "id" parameters.
  val := bone.GetValue(req, "id")

  rw.Write([]byte(val))
}

Blog Posts

Libs

  • Errors dump for Go : Trash
  • Middleware Chaining module : Claw
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].