use chopin_core::{Chopin, Context, KJson, Response, get};

#[derive(KJson)]
struct Message {
    message: &'static str,
}

#[get("/json")]
fn json(_ctx: Context) -> Response {
    let msg = Message {
        message: "Hello, World!",
    };
    Response::json(&msg)
}

#[get("/plaintext")]
fn plaintext(_ctx: Context) -> Response {
    Response::text_static(b"Hello, World!")
}

fn main() {
    println!("Starting local TFB test server on http://localhost:8000");
    Chopin::new()
        .mount_all_routes()
        .serve("0.0.0.0:8000")
        .expect("server failed");
}
