lithair-cli 1.2.0

CLI tool for scaffolding Lithair projects
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use lithair_core::prelude::*;
use std::future::Future;
use std::pin::Pin;

/// A custom route handler: takes a [`RouteRequest`] and returns a
/// [`RouteResponse`], matching the signature `with_route` expects.
pub fn handler(
    _req: RouteRequest,
) -> Pin<Box<dyn Future<Output = anyhow::Result<RouteResponse>> + Send>> {
    Box::pin(async {
        Ok(response::json(
            StatusCode::OK,
            r#"{"status":"ok","service":"{{project_name}}"}"#,
        ))
    })
}