feat(api): add techs api endpoint

This commit is contained in:
Pau Figueras 2024-05-12 04:00:34 +02:00
pare 1d9ac9535b
commit 8774c8d0be

27
src/main.rs Normal file
Veure arxiu

@ -0,0 +1,27 @@
pub mod contexts;
use rocket::serde::{json::Json, Serialize};
mod database;
#[macro_use]
extern crate rocket;
#[derive(Serialize)]
#[serde(crate = "rocket::serde")]
struct Tech {
short_name: String,
long_name: String,
}
#[get("/techs")]
fn techs() -> Json<Vec<Tech>> {
Json(vec![Tech {
short_name: "a".to_owned(),
long_name: "aaaaaa".to_owned(),
}])
}
#[launch]
fn rocket() -> _ {
rocket::build().mount("/", routes![techs])
}