Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

© 2026 Open-Awesome. Curated for the developer elite.

TermsPrivacyAboutGitHubRSS
  1. Home
  2. Go
  3. gorouter

gorouter

MITGov1.2.0

A simple and fast HTTP router for Go that supports regexp parameters and is optimized for building RESTful APIs.

Visit WebsiteGitHubGitHub
523 stars70 forks0 contributors

What is gorouter?

gorouter is a simple and fast HTTP router for the Go programming language. It provides a lightweight way to handle HTTP requests with support for URL parameters, regex patterns, and route grouping, making it ideal for building RESTful APIs and web frameworks. The project was created to offer a performant router that includes regex support, addressing gaps in other popular Go routers.

Target Audience

Go developers building web applications, REST APIs, or custom web frameworks who need a fast, regex-capable router with middleware support.

Value Proposition

Developers choose gorouter for its balance of speed and regex functionality, offering performance comparable to httprouter while providing the flexibility of regex parameters that routers like gorilla/mux support.

Overview

xujiajun/gorouter is a simple and fast HTTP router for Go. It is easy to build RESTful APIs and your web framework.

Use Cases

Best For

  • Building high-performance RESTful APIs in Go
  • Implementing regex-based URL parameter validation in routes
  • Creating route groups for API versioning or prefixes
  • Developing custom web frameworks with middleware chains
  • Serving static files with dynamic path patterns
  • Projects requiring reverse routing for URL generation

Not Ideal For

  • Projects requiring built-in WebSocket support or advanced HTTP/2 features
  • Teams that prioritize a large ecosystem of pre-built middleware and community plugins
  • Applications where complex regex patterns could lead to maintenance challenges or performance bottlenecks

Pros & Cons

Pros

High Performance Routing

Benchmarks show gorouter is nearly as fast as httprouter while supporting regex, making it ideal for speed-critical applications like REST APIs.

Regex Parameter Support

Enables flexible URL matching with named regex parameters, allowing type validation directly in routes without additional logic, as shown in the examples.

No External Dependencies

Built solely on Go's standard library, reducing bloat and ensuring compatibility with minimal setup, which the README highlights as a key feature.

Middleware Chain Flexibility

Supports seamless chaining of multiple middleware functions for request processing, demonstrated with logging and tracing in the examples.

Cons

Cumbersome Static File Serving

Static file handling requires manual regex-based path matching and custom handlers, unlike routers with built-in static serving methods, as seen in the convoluted example.

Limited Advanced Features

Lacks built-in support for subdomains, WebSockets, or integrated security middleware, necessitating custom implementations for common web needs.

Smaller Community Ecosystem

As a niche project, it has fewer third-party extensions and less frequent updates compared to established routers like chi or gorilla/mux, which may affect long-term support.

Frequently Asked Questions

Quick Stats

Stars523
Forks70
Contributors0
Open Issues0
Last commit7 years ago
CreatedSince 2018

Tags

#rest-api#regexp#golang-library#restful-api#golang#http-router#web-framework#go#router#middleware#routing#performance

Built With

G
Go

Links & Resources

Website

Included in

Go169.1k
Auto-fetched 1 day ago

Related Projects

ChiChi

lightweight, idiomatic and composable router for building Go HTTP services

Stars22,991
Forks3,620
Last commit5 days ago
muxmux

Package gorilla/mux is a powerful HTTP router and URL matcher for building Go web servers with 🦍

Stars21,834
Forks1,892
Last commit2 years ago
httprouterhttprouter

A high performance HTTP request router that scales well

Stars17,134
Forks1,464
Last commit2 years ago
webweb

Go Router + Middleware. Your Contexts.

Stars1,525
Forks117
Last commit6 years ago
Community-curated · Updated weekly · 100% open source

Found a gem we're missing?

Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.

Submit a projectStar on GitHub