@@ -1,20 +0,0 @@
|
||||
#[macro_use]
|
||||
extern crate rocket;
|
||||
use rocket::serde::{json::Json, Serialize};
|
||||
|
||||
#[derive(Serialize)]
|
||||
struct Greeting<'a> {
|
||||
hello: &'a str,
|
||||
}
|
||||
|
||||
#[get("/")]
|
||||
fn index() -> Json<Greeting<'static>> {
|
||||
Json(Greeting {
|
||||
hello: "Hello, world!",
|
||||
})
|
||||
}
|
||||
|
||||
#[launch]
|
||||
fn rocket() -> _ {
|
||||
rocket::build().mount("/api/", routes![index])
|
||||
}
|
||||
Reference in New Issue
Block a user