You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
449 B
Rust
26 lines
449 B
Rust
5 years ago
|
#![feature(proc_macro_hygiene, decl_macro)]
|
||
|
|
||
|
#[macro_use]
|
||
|
extern crate rocket;
|
||
|
#[macro_use]
|
||
|
extern crate serde_derive;
|
||
|
extern crate rocket_contrib;
|
||
|
|
||
|
use rocket_contrib::json::Json;
|
||
|
|
||
|
#[derive(Serialize)]
|
||
|
struct HelloMessage {
|
||
|
message: String,
|
||
|
}
|
||
|
|
||
|
#[get("/")]
|
||
|
fn index() -> Json<HelloMessage> {
|
||
|
Json(HelloMessage {
|
||
|
message: String::from("Hello, world"),
|
||
|
})
|
||
|
}
|
||
|
|
||
|
fn main() {
|
||
|
rocket::ignite().mount("/", routes![index]).launch();
|
||
|
}
|