bolt-web 0.1.1

⚡ A high-performance, minimalist web framework for Rust, inspired by Express.js and Gin.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use async_trait::async_trait;
use serde_json::json;

use crate::{response::ResponseWriter, types::ErrorHandler};

pub struct DefaultErrorHandler;

#[async_trait]
impl ErrorHandler for DefaultErrorHandler {
    async fn run(&self, msg: String, res: &mut ResponseWriter) {
        res.status(res.status).json(&json!({
            "error": msg
        }));
    }
}