Dynamic routing system for Rocket

Overview

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 route, save (or touch) main.rs to see the changes.

Usage

Cargo.toml

[dependencies]
rocket_router = { git = "https://github.com/DavidArsene/rocket_router" }

main.rs

#[macro_use] extern crate rocket;

use rocket_router::router;

#[router]
#[launch]
async fn rocket() -> _ {
	rocket::build().router()
}

routes/hello/world.rs

#[get("/<name>/<age>")]
pub fn world(name: &str, age: u8) -> String {
    format!("Hello, {} year old named {}!", age, name)
}

Specifying a custom route folder:

#[macro_use] extern crate rocket;

use rocket_router::router;

#[router("custom")]
#[launch]
async fn rocket() -> _ {
	rocket::build().router()
}

License

rocket_router is licensed under either of the following, at your option:

You might also like...
An implementation for an authentication API for Rocket applications.

rocket_auth rocket_auth provides a ready-to-use backend agnostic API for authentication management. For more information visit the documentation at ht

Inertia.js implementations for Rust. Currently supports Rocket.

Inertia.rs Inertia.js implementations for Rust. Currently supports Rocket. Why Inertia? From inertiajs.com Inertia is a new approach to building class

CRUD example with Rocket, Toql and MySQL

Todo (Rocket, Toql, MySQL) This is a little REST server built with Rocket, Toql and MySQL. The server allows to call CRUD functions on a Todo item. It

🦀 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

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

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

rs-regex-router An implementation of request routing via a singular grouped regex (with support for path parameter extraction). Features Design approa

A demo blog post engine in Rust, using Rocket and MongoDB
A demo blog post engine in Rust, using Rocket and MongoDB

A demo blog post engine written in Rust, using Rocket and MongoDB Quick Start Setup a new MongoDB cluster https://cloud.mongodb.com/ create a new data

Routing - specialised storage DHT

PLEASE NOTE THAT THIS REPOSITORY HAS NOW BEEN ARCHIVED All routing development is now via the safe_network repository sn_routing sn_routing - a specia

Server with Rust, Rocket, Diesel, Docker to create your own to-do-list

Installation Install Docker & Docker-Compose Then download the repository go to the root where the Dockerfile is and do: sudo docker-compose up sudo i

An example of a fairing for rocket to use tracing (as this pops up at many places in dicussions and questions)
An example of a fairing for rocket to use tracing (as this pops up at many places in dicussions and questions)

Rocket Tracing Fairing Example This repository aims to give a short example of how you can add a Fairing to your Rocket for tracing and how to use it

Peer-to-peer overlay routing

Rust_Pinecone This is a port of the peer-to-peer overlay routing mechanism Pinecone and aims to be interoperable with it, although it isn't yet becaus

Simple RESTful API in rust created with actix-web. (Routing, models, JWT auth).

rust-simple-api Simple RESTful API created with rust, actix-web, Diesel, JWT. Running application Manual Firstly generate a secret.key which will be u

Rust Rocket MongoDB token-authorization REST API boilerplate

Rust Rocket MongoDB token-auth REST API boilerplate In this repository, you can find backend Rust rocket mongodb rest-api boilerplate with token autho

Build some cyber security tools in Rust :crab: :rocket:

here we're trying to write some tools for cyber security in Rust because we don't have enough community for Rust in the cyber security field soo this

Simple Rust 🦀 api with Rocket 🚀

Car API Written in Rust & Rocket.rs 🦀 🚀 Running project Running by cargo You just need to run the following command: cargo run Running on docker Fi

Rust-Rocket framework template Demo

rocketapp Rust-Rocket framework template Demo dependencies are defined in Cargo.toml Clone as: git clone https://github.com/srikantgdev/rocketapp [op

Bare-metal software for the sounding rocket payload.

CanSat Software for the sounding rocket payload. Prerequisites cargo-make cargo-embed - Requires libusb, see cargo-embed's README.md for instructions.

Draw routes in MapLibre snapped to a street network using client-side routing
Draw routes in MapLibre snapped to a street network using client-side routing

MapLibre route snapper This plugin lets you draw routes in MapLibre GL that snap to some network (streets, usually). Unlike similar plugins that send

Holo is a suite of routing protocols designed to support high-scale and automation-driven networks.

Holo is a suite of routing protocols designed to support high-scale and automation-driven networks. For a description of what a routing protocol is, p

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

rs-regex-router An implementation of request routing via a singular grouped regex (with support for path parameter extraction). Features Design approa

Harry 1 Nov 25, 2021
A demo blog post engine in Rust, using Rocket and MongoDB

A demo blog post engine written in Rust, using Rocket and MongoDB Quick Start Setup a new MongoDB cluster https://cloud.mongodb.com/ create a new data

Nabil Hachicha 5 Oct 19, 2022
Server with Rust, Rocket, Diesel, Docker to create your own to-do-list

Installation Install Docker & Docker-Compose Then download the repository go to the root where the Dockerfile is and do: sudo docker-compose up sudo i

Lucas Aries 3 Aug 19, 2022
A no-nonsense CAPTCHA system with seamless UX | Backend component

mCaptcha Proof of work based, privacy respecting CAPTCHA system with a kickass UX. STATUS: ACTIVE DEVELOPMENT Skip to demo mCaptcha is a privacy respe

mCaptcha 818 Jan 2, 2023
A dead simple human-writable URL redirector based loosely on google's `go/` system.

Redirector a redirector written in rust intended for permanent human-readable redirects. The idea was semi-inspired by the book Software Engineering a

Jan Harasym 4 Dec 14, 2022
Easy c̵̰͠r̵̛̠ö̴̪s̶̩̒s̵̭̀-t̶̲͝h̶̯̚r̵̺͐e̷̖̽ḁ̴̍d̶̖̔ ȓ̵͙ė̶͎ḟ̴͙e̸̖͛r̶̖͗ë̶̱́ṉ̵̒ĉ̷̥e̷͚̍ s̷̹͌h̷̲̉a̵̭͋r̷̫̊ḭ̵̊n̷̬͂g̵̦̃ f̶̻̊ơ̵̜ṟ̸̈́ R̵̞̋ù̵̺s̷̖̅ţ̸͗!̸̼͋

Rust S̵̓i̸̓n̵̉ I̴n̴f̶e̸r̵n̷a̴l mutability! Howdy, friendly Rust developer! Ever had a value get m̵̯̅ð̶͊v̴̮̾ê̴̼͘d away right under your nose just when

null 294 Dec 23, 2022
GaiaX dynamic template engine is a lightweight cross-platform solution for pure native dynamic card.

GaiaX dynamic template engine is a lightweight cross-platform solution for pure native dynamic card, developed by Alibaba YouKu technology team GaiaX

Alibaba 774 Dec 22, 2022
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 722 Dec 27, 2022
:rocket: Automatic crate publishing done right

semantic-rs The purpose of this tool is to help people to publish crates following the semver specification. Right now if you're building a new crate

semantic-rs 165 Oct 9, 2022
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 34 Oct 22, 2022