feat(api): add techs api endpoint
This commit is contained in:
pare
1d9ac9535b
commit
8774c8d0be
S'han modificat 1 arxius amb 27 adicions i 0 eliminacions
27
src/main.rs
Normal file
27
src/main.rs
Normal file
|
@ -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])
|
||||
}
|
Loading…
Referencia en una nova incidència