About
Overview
Jeep train is an experimental high level web framework
The project is purely experimental and it is not meant to be used in a production environment.
The motivation behind the development is to
- see if procedural macro can help define a runtime efficient router productively
- explore ways to minimize boilerplate/learning cost
Feature
- Define your api routes on rails like syntax. API Syntax is straight forward and inputs are converted into match statement
Conn
object will be passed onto every functions invoked in the process of handling client request and it will act as a primary interface for interacting with request/response data
Routing
It looks like this.
router!
Example
This code can be found on examples/resources
.
use *;
use ;
use jeep_train;
plugin!
router!
server!
/// # Routes that it creates
///
/// | method | path | function |
/// | --- | --- | --- |
/// | get | /resource/ | resource_module::index |
/// | get | /resource/new | resource_module::new |
/// | post | /resource/ | resource_module::create |
/// | get | /resource/show | resource_module::show |
/// | get | /resource/:id/edit | resource_module::edit |
/// | put | /resource/:id | resource_module::update |
/// | patch | /resource/:id | resource_module::update |
/// | delete | /resource/ | resource_module::destroy |
///
/// Note that `/:id` is a parameterized segment
///
Benchmark
Jeep train doesn't use regular expression.
However, I think it's uncommon to register a regular expression on router on parameterized path
to identify specific format of data.
running 2 tests
test router_actix ... bench: 836,812 ns/iter (+/- 22,033)
test router_jeep_train ... bench: 1,491 ns/iter (+/- 51)
Detail can be found in benchmark-result