rapid-test/pages/api/routes/hello.rs

21 lines
535 B
Rust

use rapid_web::actix::HttpResponse;
use rapid_web::rapid_web_codegen::rapid_handler;
use serde::{ Serialize, Deserialize };
pub const ROUTE_KEY: &str = "hello";
pub type RapidOutput = HelloResponse;
#[derive(Serialize, Deserialize, Clone, Debug)]
pub struct HelloResponse {
plain: String,
colored: String,
}
#[rapid_handler]
pub async fn query() -> HttpResponse {
HttpResponse::Ok().json(HelloResponse {
plain: "Rapid, Rust powered NextJS for".to_string(),
colored: "a faster web!".to_string(),
})
}