1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
//! Serwus is a set of helpers for building actix-web/diesel based services.
//!
//! ## Features
//!
//! * **[MultiPool](db_pool::multi::MultiPool)** - Master/replica-aware wrapper for `r2d2`
//! * **[StatsPresenter](server::stats::StatsPresenter)** - Framework for readiness and statistics reporting
//! * **[JsonError](server::json_error::JsonError)** - Middleware that makes actix-web return errors as JSONs
//!
//! ## Example
//!
//! ```no_run
//! use serwus::{
//! server::{Serwus, default_cors},
//! EmptyStats,
//! web,
//! };
//!
//! #[derive(Clone, EmptyStats)]
//! pub struct AppData;
//!
//! # #[cfg_attr(feature = "swagger", paperclip::actix::api_v2_operation)]
//! async fn hello() -> &'static str {
//! "Hello world\n"
//! }
//!
//! #[actix_web::main]
//! async fn main() -> std::io::Result<()> {
//! let prepare_app_data = || AppData;
//!
//! Serwus::default()
//! .start(
//! prepare_app_data,
//! |app| {
//! app.route("/", web::get().to(hello));
//! },
//! default_cors,
//! )
//! .await
//! }
//! ```
/// Re-export of `web` from `actix-web` or from `paperclip` if swagger feature enabled.
pub use web;
pub use web;
/// Automatic implementation of [StatsPresenter](server::stats::StatsPresenter)
///
/// Returns `()` as stats, and always repors as ready.
pub use EmptyStats;