ngyn.rs

Craft Scalable Web Applications with Ease in Rust!

Get started
use ngyn::prelude::*;
#[injectable]
pub struct WeatherGate;
impl NgynGate for WeatherGate {
    fn can_activate(self, _request: &mut NgynRequest) -> bool {
        true
    }
}
#[controller]
pub struct WeatherController {}
#[routes]
#[check(WeatherGate)]
impl WeatherController {
    #[get("/weather")]
    async fn get_weather(&self, _req: &NgynRequest, _res: &mut NgynResponse) -> String {
        "Hello Weather from Ngyn".to_string()
    }
}