25 lines
523 B
Rust
25 lines
523 B
Rust
#![feature(proc_macro_hygiene, decl_macro)]
|
|
|
|
use rocket::{get, post, routes};
|
|
use rocket_contrib::json::Json;
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
#[derive(Debug, Deserialize, Serialize)]
|
|
struct Data (serde_json::Value);
|
|
|
|
#[get("/")]
|
|
fn index() -> &'static str {
|
|
"Hello, webhookey!"
|
|
}
|
|
|
|
#[post("/", format = "json", data = "<data>")]
|
|
fn receive_hook(data: Json<Data>) -> String {
|
|
format!("data: {:?}", data)
|
|
}
|
|
|
|
fn main() {
|
|
rocket::ignite()
|
|
.mount("/", routes![index, receive_hook])
|
|
.launch();
|
|
}
|