All Projects → aofei → r2

aofei / r2

Licence: MIT license
A minimalist HTTP request routing helper for Go.

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to r2

node-match-path
Matches a URL against a path. Parameters, wildcards, RegExp.
Stars: ✭ 30 (-6.25%)
Mutual labels:  routing, request
mswjs.io
Official website and documentation for the Mock Service Worker library.
Stars: ✭ 77 (+140.63%)
Mutual labels:  routing, request
JWT-user-auth-API-bolilerplate
Boilerplate for backend API user authentication with JWT
Stars: ✭ 13 (-59.37%)
Mutual labels:  routing
urltree
Named URL data structure with support for URL building.
Stars: ✭ 36 (+12.5%)
Mutual labels:  routing
routing-py
🌎 Python library to access all public routing, isochrones and matrix APIs in a consistent manner.
Stars: ✭ 106 (+231.25%)
Mutual labels:  routing
rust-file
Trivial 1-liner for reading files
Stars: ✭ 15 (-53.12%)
Mutual labels:  helper
nuxt-i18n-routing
Localized routing with Nuxt.js
Stars: ✭ 32 (+0%)
Mutual labels:  routing
flow-router
🚦 Carefully extended flow-router for Meteor
Stars: ✭ 191 (+496.88%)
Mutual labels:  routing
router
Bidirectional Ring router. REST oriented. Rails inspired.
Stars: ✭ 78 (+143.75%)
Mutual labels:  routing
net
A small, modern, PSR-7 compatible PSR-17 and PSR-18 network library for PHP, inspired by Go's net package.
Stars: ✭ 16 (-50%)
Mutual labels:  request
STCRouter
基于标准URL的iOS路由系统,可实现业务模块组件化,控制器之间零耦合,可实现黑白名单控制,可进行native降级到hybrid。
Stars: ✭ 19 (-40.62%)
Mutual labels:  routing
framework
Cygnite PHP Framework- A Modern Toolkit For Web Developers
Stars: ✭ 43 (+34.38%)
Mutual labels:  routing
optimization
Routing optimization module module for Itinero.
Stars: ✭ 47 (+46.88%)
Mutual labels:  routing
http
Aplus Framework HTTP Library
Stars: ✭ 113 (+253.13%)
Mutual labels:  request
tilegrinder
♻️ A node.js GIS helper library for easy alteration of Vector Tiles in an MBTiles container
Stars: ✭ 64 (+100%)
Mutual labels:  helper
vue-methods-promise
Let Vue methods support return Promise
Stars: ✭ 35 (+9.38%)
Mutual labels:  request
GapFlyt
GapFlyt: Active Vision Based Minimalist Structure-less Gap Detection For Quadrotor Flight
Stars: ✭ 30 (-6.25%)
Mutual labels:  minimalist
HerePy
A library that provides a Python interface to the HERE APIs.
Stars: ✭ 73 (+128.13%)
Mutual labels:  routing
OpenU-IntroToJava
מבוא למדעי המחשב ושפת ג'אווה
Stars: ✭ 19 (-40.62%)
Mutual labels:  helper
go-reverse-proxy
Reverse proxy with simple routing configuration and override behaviour
Stars: ✭ 21 (-34.37%)
Mutual labels:  routing

R2

GitHub Actions codecov Go Report Card PkgGoDev

A minimalist HTTP request routing helper for Go.

The name "R2" stands for "Request Routing". That's all, R2 is just a capable little helper for HTTP request routing, not another fancy web framework that wraps net/http.

R2 is built for people who:

  • Think net/http is powerful enough and easy to use.
  • Don't want to use any web framework that wraps net/http.
  • Don't want to use any variant of http.Handler.
  • Want http.ServeMux to have better performance and support path parameters.

Features

  • Extremely easy to use
  • Blazing fast (see benchmarks)
  • Based on radix tree
  • Sub-router support
  • Path parameter support
  • No http.Handler variant
  • Middleware support
  • Zero third-party dependencies
  • 100% code coverage

Installation

Open your terminal and execute

$ go get github.com/aofei/r2

done.

The only requirement is the Go, at least v1.13.

Hello, 世界

Create a file named hello.go

package main

import (
	"fmt"
	"net/http"

	"github.com/aofei/r2"
)

func main() {
	r := &r2.Router{}
	r.Handle("", "/hello/:name", http.HandlerFunc(hello))
	http.ListenAndServe("localhost:8080", r)
}

func hello(rw http.ResponseWriter, req *http.Request) {
	fmt.Fprintf(rw, "Hello, %s\n", r2.PathParam(req, "name"))
}

and run it

$ go run hello.go

then visit http://localhost:8080/hello/世界.

Community

If you want to discuss R2, or ask questions about it, simply post questions or ideas here.

Contributing

If you want to help build R2, simply follow this to send pull requests here.

License

This project is licensed under the MIT License.

License can be found here.

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].