An implementation of request routing via a singular grouped regex (with support for path parameter extraction).

Overview

rs-regex-router

GitHub license Crates.io docs.rs

An implementation of request routing via a singular grouped regex (with support for path parameter extraction).

Features

  • Design approach based upon this article.
  • Implemented over a generic handler type allowing use with varying webserver crates.
  • Extraction of path parameters which are then mapped as key/value pairs.
  • Convenience macros for easily declaring routes and obtaining path parameter values.

Installation & Basic Usage

[dependencies]
regex_router = "1.0.0"

An example using a unit handler type:

use regex_router::{RouterBuilder, route};
...

let mut builder = RouterBuilder::<()>::new();

route!(builder; r"/example";; "GET" => ());
route!(builder; r"/test";; "GET" => ());

let router = builder.build().unwrap();

An example declaring path parameters:

let mut builder = RouterBuilder::<()>::new();

route!(builder; r"/example/(\d+)"; "var1"; "GET" => ());
route!(builder; r"/test/(\d+)/(\d+)"; "var1", "var2"; "GET" => ());

let router = builder.build().unwrap();

Dispatching against a router:

match router.dispatch("GET", "/example/500") {
  Some(route_match) => {
    // Call handler and return response.
  }
  None => {
    // No route match. Return 404.
  }
};

An example hyper implementation can be found here: TBC

Issues & Support

Whether you're wanting to report a bug you've come across during use of this crate or are seeking general help/assistance, please utilise the issues tracker and provide as much detail as possible (eg. recreation steps).

I try to respond to issues within a reasonable timeframe.

Releases(V1.0.2)
Owner
Harry
Harry
Dynamic routing system for Rocket

rocket_router Dynamic routing system for Rocket Caveats Each file should export only one route, named the same as the file itself. After adding a new

David Arsene 1 Oct 27, 2021
JSON Web Token implementation in Rust.

Frank JWT Implementation of JSON Web Tokens in Rust. Algorithms and features supported HS256 HS384 HS512 RS256 RS384 RS512 ES256 ES384 ES512 Sign Veri

Alex Maslakov 235 Nov 5, 2021
Akasio is a simple HTTP server that redirects traffic based on a JSON redirect table. This is its Rust implementation.

This page is inaccurate and is pending updates. Akasio (Rust) Description Akasio is a simple HTTP server that redirects traffic based on a JSON redire

K4YT3X 5 Jun 8, 2021
url parameter parser for rest filter inquiry

inquerest Inquerest can parse complex url query into a SQL abstract syntax tree. Example this url: /person?age=lt.42&(student=eq.true|gender=eq.'M')&

Jovansonlee Cesar 25 Nov 2, 2020
A fast isosurface extraction algorithm.

fast-surface-nets A fast, chunk-friendly implementation of Naive Surface Nets on regular grids. Surface Nets is an algorithm for extracting an isosurf

Duncan 4 Nov 14, 2021
A blazingly fast static web server with routing, templating, and security in a single binary you can set up with zero code. :zap::crab:

binserve ⚡ ?? A blazingly fast static web server with routing, templating, and security in a single binary you can set up with zero code. ?? UPDATE: N

Mufeed VH 498 Nov 21, 2021
Parameterized routing for generic resources in Rust

Usher Usher provides an easy way to construct parameterized routing trees in Rust. The nodes of these trees is naturally generic, allowing Usher to le

Isaac Whitfield 30 Sep 24, 2021
Dynamic routing system for Rocket

rocket_router Dynamic routing system for Rocket Caveats Each file should export only one route, named the same as the file itself. After adding a new

David Arsene 1 Oct 27, 2021
🦀 Rust Graph Routing runtime for Apollo Federation 🚀

Apollo Router The Apollo Router is a configurable, high-performance graph router for a federated graph. Getting started Follow the quickstart tutorial

Apollo GraphQL 85 Nov 24, 2021
The Safe Network Core. API message definitions, routing and nodes, client core api.

safe_network The Safe Network Core. API message definitions, routing and nodes, client core api. License This Safe Network repository is licensed unde

MaidSafe 32 Nov 29, 2021
rurl is like curl but with a json configuration file per request

rurl rurl is a curl-like cli tool made in rust, the difference is that it takes its params from a json file so you can have all different requests sav

Bruno Ribeiro da Silva 5 Nov 20, 2021
Http request smuggling vulnerability scanner

Request smuggler Http request smuggling vulnerability scanner Based on the amazing research by James Kettle. The tool can help to find servers that ma

null 127 Nov 21, 2021
QueingSimulator is an application that can be used to build intuitions about behavior of synchronous request/reply systems

Queueing Simulator QueingSimulator is an application that can be used to build intuitions about behavior of synchronous request/reply systems (such as

Joe Magerramov 6 Nov 7, 2021
Proxy sentry request to a sentry server using a tunnel/proxy endpoint

Sentry Tunnel This is a proxy that forwards tunneled sentry requests to the real sentry server. The implementation is based on the explanation provide

Paul FLORENCE 4 Nov 4, 2021
Plugin to request a relaunch when uploading a Skyline plugin through cargo skyline

restart-plugin A skyline plugin for allowing cargo-skyline (or other tools) to restart your game without you having to touch your controller. Install

null 1 Nov 21, 2021
HTTP request logger

nosy - HTTP request logger How hard can it be to build your own HTTP request logger in Rust? Well, not that easy if you've never written a webapp in R

Manuel Hutter 1 Nov 26, 2021
A Rust macro for writing regex pattern matching.

regexm A Rust macro for writing regex pattern matching.

Takayuki Maeda 41 Nov 3, 2021
ripgrep recursively searches directories for a regex pattern while respecting your gitignore

ripgrep (rg) ripgrep is a line-oriented search tool that recursively searches the current directory for a regex pattern. By default, ripgrep will resp

Andrew Gallant 28.2k Nov 23, 2021
git-cliff can generate changelog files from the Git history by utilizing conventional commits as well as regex-powered custom parsers.⛰️

git-cliff can generate changelog files from the Git history by utilizing conventional commits as well as regex-powered custom parsers. The changelog template can be customized with a configuration file to match the desired format.

Orhun Parmaksız 3.5k Nov 29, 2021
Logpeek is a simple logfile regex matcher program

Logpeek is a simple logfile regex matcher program. It allows matching a file line by line using regular expressions and can be configured using a JSON based configuration file.

Lukas 1 Oct 28, 2021
An API for getting questions from http://either.io implemented fully in Rust, using reqwest and some regex magic. Provides asynchronous and blocking clients respectively.

eithers_rust An API for getting questions from http://either.io implemented fully in Rust, using reqwest and some regex magic. Provides asynchronous a

null 2 Oct 24, 2021
A tui to test regexes on the rust regex crate

regex-tui Structure src/ ├── app.rs -> holds the states and renders the widgets ├── event.rs -> handles the terminal events (key press, mouse cl

null 1 Oct 21, 2021
Calcit binding to Rust regex

Rust library for Calcit runtime.

Calcit 1 Nov 19, 2021
Walk an Amazon s3 path hierarchy

s3find A command line utility to walk an Amazon S3 hierarchy. An analog of find for Amazon S3. Distribution Release page distributions Github Release

Andrii Radyk 29 Nov 19, 2021
gt your desired path with minimal keystrokes

goto (gt) gt is a simple and user-friendly way to jump to your indexed directories. gt is short for "goto", which is basically what you want to do wit

Sylvester Chin 24 Aug 14, 2021
Fuse filesystem that returns symlinks to executables based on the PATH of the requesting process.

Envfs Fuse filesystem that returns symlinks to executables based on the PATH of the requesting process. This is useful to execute shebangs on NixOS th

Jörg Thalheim 44 Nov 22, 2021
CLI utility to move (or rename) your files to a new location and redirect all of its symbolic links, to the new path

Move Links CLI utility to move (or rename) your files to a new location and redirect all of its symbolic links, to the new path (or name). Usage execu

Ben Mefteh 17 Sep 15, 2021
Fast shortest path calculations for Rust

Fast Paths The most famous algorithms used to calculate shortest paths are probably Dijkstra's algorithm and A*. However, shortest path calculation ca

Andi 201 Nov 15, 2021
Add path effects to open glyphs in a UFO file

ufostroker Add path effects to open contours in a UFO file Given a glyph with open contours: You can apply a noodle effect: ufostroker -i Open.ufo -o

Simon Cozens 5 Jun 28, 2021