derust
Easy way to start your Rust asynchronous application server using Tokio and Axum frameworks.
Basic usage example
# Cargo.toml
[]
= "sample"
= "0.1.0"
= "2021"
[]
= { = "0.3.13" }
= { = "1.43.0", = ["full"] }
= { = "0.8.1", = true, = ["macros", "tokio"] }
= { = "1.0.133" }
// main.rs
use State;
use StatusCode;
use get;
use Router;
use Environment;
use JsonResponse;
use ;
use tracex;
use json;
async
async
Envs
| env | default | description |
|---|---|---|
| SERVER_TIMEOUT_IN_MILLIS | 10000 | Maximum time in milliseconds that the server will try to respond to a request before returning a timeout error (408 Request Timeout) |
Tests
Active start_test feature
= { = "0.3.13", = ["start_test"] }
And then:
let env = detect.ok.unwrap_or;
// any cloneable struct
let app_state = AppState ;
let application_name = "sample";
// easy way to get application context things, like your application state struct
let context = new?;
let router = new.nest;
let listener = bind.await.unwrap;
start_test.await
Features
- aws
- database
- env (default)
- growthbook
- http_client
- metrics
- outbox
- trace (default)
License
This project is licensed under the MIT license.